Problem p02621 - Generation 2

Orig Description

Score : 100 points
Problem StatementGiven an integer a as input, print the value a + a^2 + a^3.
Constraints
1 \leq a \leq 10
a is an integer.
InputInput is given from Standard Input in the following format:
a
OutputPrint the value a + a^2 + a^3 as an integer.
Sample Input 12
Sample Output 114
When a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.
Print the answer as an input. Outputs such as 14.0 will be judged as incorrect.
Sample Input 210
Sample Output 21110

Extracted Specification

Canonicalized Input Description:

An integer X (1 ≤ X ≤ 10), representing some quantity or size.

### Example Input:

```
2
```

### Function Signature:
Write a function f(X) that takes in the input.
def f(X: int):
    '''
    X: an integer
    '''

Test Case Generator

Sure! Here's a test case generator for the given problem statement:

### Problem Statement: Compute \( a + a^2 + a^3 \)

**Description**

Given an integer \(a\), compute the value \(a + a^2 + a^3\).

**Input**

An integer \(a\) (1 ≤ \(a\) ≤ 10).

**Output**

Print the value of \(a + a^2 + a^3\) as an integer.

**Examples**

_Input_

```
2
```

_Output_

```
14
```

_Input_

```
10
```

_Output_

```
1110
```

**Explanation**

For the first example, when \(a = 2\):
\[ 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14 \]

For the second example, when \(a = 10\):
\[ 10 + 10^2 + 10^3 = 10 + 100 + 1000 = 1110 \]

### Test Case Generator

Here is the Python function to generate test cases:

```python
import random

def tcgen():
    a = random.randint(1, 10)
    return a

# Example usage
if __name__ == "__main__":
    test_case = tcgen()
    print(test_case)
```

This function `tcgen` generates a random integer \(a\) within the given constraints (1 ≤ \(a\) ≤ 10). You can use this function to create multiple test cases for the problem.

Extract Arguments

def extract_arguments(fh):
    a = int(fh.readline().strip())
    return a