Problem E
Immortal Porpoises
As everyone knows, immortal porpoises live on the other side of straight lines and eat live seagulls, although Federal Law prohibits transporting the gulls to them (but that’s another story).
The well-known scientist Leo
Each year, all the porpoises that were around last year are
still there. But in addition, all the porpoises who were around
two years earlier have babies! However, to prevent the world
from being overrun with immortal porpoises, whenever their
numbers reach one billion (
Suppose each picture
represents a pair alive at the end of the year. Then our
year-to-year Porpoise Population chart would look something
like this:
Year |
Pair Count |
Porpoise Pairs Alive |
1 |
1 |
|
2 |
1 |
|
3 |
2 |
|
4 |
3 |
|
5 |
5 |
|
6 |
8 |
|
7 |
13 |
|
8 |
21 |
|
|
|
|
43 |
433494437 |
|
44 |
701408733 |
|
45 |
134903170 |
|
46 |
836311903 |
|
Your job is to write a program that determines the number of
immortal porpoise pairs alive at the end of a given number of
years, assuming that you start with a newborn pair at the
beginning of the
Input
The first line of input contains a single integer
Output
For each data set there is a single line of output. The line
consists of the data set number,
Sample Input 1 | Sample Output 1 |
---|---|
11 1 1 2 2 3 8 4 20 5 46 6 60 7 3749999998 8 3749999999 9 3750000000 10 3750000001 11 281474976710656 |
1 1 2 1 3 21 4 6765 5 836311903 6 8755920 7 499999999 8 500000001 9 0 10 500000001 11 309764667 |