#C5203. Sum of Fibonacci Numbers
Sum of Fibonacci Numbers
Sum of Fibonacci Numbers
Given a non-negative integer \(N\), compute the sum of the first \(N\) Fibonacci numbers. The Fibonacci sequence is defined as follows: \(F(0)=0\), \(F(1)=1\), and for all \(n \ge 2\), \(F(n)=F(n-1)+F(n-2)\). Formally, you need to calculate:
\(S(N)=\sum_{i=0}^{N-1} F(i)\).
For example, if \(N=5\), the Fibonacci numbers are \(0, 1, 1, 2, 3\) and their sum is \(7\).
inputFormat
Input consists of a single integer (N) ((0 \le N \le 10^5)) provided on a single line from standard input.
outputFormat
Output a single integer which is the sum of the first (N) Fibonacci numbers. The result should be written to standard output.## sample
0
0