#C14006. Fibonacci Sequence Sum
Fibonacci Sequence Sum
Fibonacci Sequence Sum
Given a value \(n\), compute the sum of the first \(n\) numbers in the Fibonacci sequence. Recall that the Fibonacci sequence is defined as \(F_0 = 0\), \(F_1 = 1\), and for \(n \ge 2\), \(F_n = F_{n-1} + F_{n-2}\). Thus, the sum to be computed is:
\[ S = \sum_{i=0}^{n-1} F_i \]
If the input \(n\) is negative or is not a valid integer, your program should output "Invalid input".
inputFormat
The input is provided via stdin as a single line containing a value. This value should represent a non-negative integer (n).
outputFormat
Output the sum of the first (n) Fibonacci numbers to stdout. If the input is invalid (i.e. negative or non-integer), print "Invalid input".## sample
0
0