#K8661. Sum of Even Fibonacci Numbers

    ID: 36903 Type: Default 1000ms 256MiB

Sum of Even Fibonacci Numbers

Sum of Even Fibonacci Numbers

Given an integer \(X\), your task is to compute the sum of all even Fibonacci numbers that do not exceed \(X\). The Fibonacci sequence is defined as:

\(F_0 = 0, \; F_1 = 1, \; F_{n} = F_{n-1} + F_{n-2} \text{ for } n \geq 2.\)

You need to output the sum of all even numbers in this sequence such that each number is less than or equal to \(X\).

For example, when \(X = 10\), the Fibonacci sequence is \(0, 1, 1, 2, 3, 5, 8, 13, \dots\) and the even numbers are \(0, 2, 8\) which add up to \(10\).

inputFormat

The input consists of a single line containing a non-negative integer \(X\) (\(0 \leq X \leq 10^9\)).

outputFormat

Output a single integer, which is the sum of all even Fibonacci numbers less than or equal to \(X\).

## sample
1
0