- All Contests
- ProjectEuler+
- Project Euler #104: Pandigital Fibonacci ends

# Project Euler #104: Pandigital Fibonacci ends

# Project Euler #104: Pandigital Fibonacci ends

_{This problem is a programming version of Problem 104 from projecteuler.net}

The Generalized Fibonacci sequence is defined by the recurrence relation:

It turns out that , which contains digits, is the first Fibonacci number for which the last nine digits are pandigital (contain all the digits to , but not necessarily in order). And , which contains digits, is the first Fibonacci number for which the first nine digits are pandigital.

Given that is the first Generalized Fibonacci number for which the first digits AND the last digits are pandigital, find .

**NOTE** For this problem if you don't find a solution with in , print `no solution`

.

**Input Format**

First line of input contains , second line contains and the third line contains .

**Constraints**

**Output Format**

Print the value where is the required generalized fibonacci term.

**Sample Input**

```
1
1
2
```

**Sample Output**

```
8
```