## Problem

We define a modified Fibonacci sequence using the following definition:

Given terms *t*_{i} and *t*_{i+1} where *i* ∈ (1,∞), term *t*_{i+2} is computed using the following relation:

*t*_{i+2} = t_{i} + (t_{i+1})^{2}

For example, if *t*1 = 0 and *t*2 = 1,

*t*3 = 0 + 1^{2} = 1,
*t*4 = 1 + 1^{2} = 2,
*t*5 = 1 + 2^{2} = 5,
- and so on.

Given three integers, *t*1, *t*2, and *n*, compute and print the *n*^{th} term of a *modified Fibonacci sequence*.

### Function Description

Complete the *fibonacciModified* function in the editor below. It must return the *n*^{th} number in the sequence.

fibonacciModified has the following parameter(s):

- t1: an integer
- t2: an integer
- n: an integer

**Note:** The value of *t*_{n} may far exceed the range of a 64-bit integer. Many submission languages have libraries that can handle such large results but, for those that don't (e.g., C++), you will need to compensate for the size of the result.

### Input Format

A single line of three space-separated integers describing the respective values of *t*1, *t*2, and *n*.

### Constraints

- 0 ≤ t1,t2 ≤ 2
- 3 ≤ n ≤ 20
*t*_{n} may far exceed the range of a 64-bit integer.

### Output Format

Print a single integer denoting the value of term *t*_{n} in the modified Fibonacci sequence where the first two terms are *t*1 and *t*2.

## Solution

```
// Complete the fibonacciModified function below.
static BigInteger fibonacciModified(int t1, int t2, int n) {
BigInteger term = new BigInteger(0);
BigInteger num1 = new BigInteger(t1);
BigInteger num2 = new BigInteger(t2);
for (int i = 0; i < n-2; i++)
{
term = num1 + (num2 * num2);
num1 = num2;
num2 = term;
}
return term;
}
```