Sum of even Fibonacci numbers
Go
Easy
math
Task «Sum of even Fibonacci numbers»
Write a program that finds the sum of all even numbers in the Fibonacci sequence that do not exceed a given number N. The Fibonacci sequence starts with 1 and 2. If N is less than 2, the sum is 0.
Input Format
One integer N (1 ≤ N ≤ 10^6).
Output Format
One integer — the sum of all even Fibonacci numbers not exceeding N.
Examples
Example 1
INPUT
100
OUTPUT
44
Example 2
INPUT
1 3
OUTPUT
10
Example 3
INPUT
1
OUTPUT
0
Example 4
INPUT
2 5
OUTPUT
10
main.go