spoj#PIB. Pibonacci
Pibonacci
You might have heard of the Fibonacci numbers and of the number pi. If you let these two ideas merge, a new and esoteric concept comes into being: the Pibonacci numbers. These can be defined for real x>=0 by:
P(x) = 1 | for 0<=x<4 |
P(x) = P(x-1) + P(x-pi) | for 4<=x, |
where pi = 3.1415926535... In this problem, you are asked to compute P(x) for a given x.
Input file specification
The input file contains several non-negative integer numbers (less than 30000) each on a separate line. The last line contains -1 marking the end of the input file.
Output file specification
For each non-negative real number in the input file, output the corresponding Pibonacci number. If the Pibonacci number be more than 50 digits long, divide it on the consecutive lines, outputting 50 digits on each (the last line may contain less digits).
Example
Input file:
0 4 11 -1
Output file:
1 2 20