0140. Fidonacci Numbers

Input file name: fido.in
Output file name: fido.out
Time limit: 500 ms
Memory limit: 64 megabytes

Fidonacci numbers are defined by conditions F0=0, F1=F2=1 and Fk=Fk-1+Fk-3 for all k ≥ 3. You are to find FN for a given N.

Input file

One integer number N, 0 ≤ N ≤ 1000.

Output file

Just output the N-th Fidonacci number.

Examples:

fido.infido.out
00
11
21


Source: Petrozavodsk Summer 2003. Blitz Kontest, Monday, August 25
Author: Andrew Lopatin, Nick Durov

Discuss       Submit a solution



Printable version