#C1167. Fibonacci Sum
Fibonacci Sum
Fibonacci Sum
You are given a non-negative integer \(n\). Your task is to compute the sum of the first \(n+1\) Fibonacci numbers, i.e., from \(F_0\) up to \(F_n\), where:
[ F_0 = 0,\quad F_1 = 1,\quad F_n = F_{n-1} + F_{n-2} \text{ for } n \ge 2. ]
For example, when \(n = 5\), the Fibonacci sequence is \(0, 1, 1, 2, 3, 5\) and its sum is \(0+1+1+2+3+5 = 12\). You need to implement a program that reads an integer from standard input, computes this sum, and writes the result to standard output.
inputFormat
The input consists of a single integer \(n\) (\(0 \le n\)).
outputFormat
Output a single integer which is the sum of Fibonacci numbers from \(F_0\) to \(F_n\), i.e., \(\sum_{i=0}^{n} F_i\).
## sample0
0