Programming - Fibonacci Number - SW Competency Test
Quiz Info
Quiz Info
Programming - Fibonacci Number
100points

The goal is to sum up to the n-th term of the Fibonacci Number, a popular sequence in mathematics.

F0=0, F11=1, Fn+2n+2=Fn+1n+1+Fnn

We can define the Fibonacci sequence with the recurrence relation as above.

Based on the 0th term being 0 and the 1st term being 1, from the 2nd term, the number of the previous two is added.

Listed below is the outcome:

(0), 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377 ... and so on.

Write a program to sum up to the n-th Fibonacci Number

Input

Natural number (less than 30)

Output

Sum of Fibonacci Sequence Terms from 1 to natural number Entered


Input/Output Example
:
Blank
:
Line Break
:
Tab
Example 1
Input
10
Output
143
Example 2
Input
20
Output
17710
⋇ Please keep the input and output formats carefully
Quiz Info