#K16251. Even Fibonacci Sum

    ID: 24537 Type: Default 1000ms 256MiB

Even Fibonacci Sum

Even Fibonacci Sum

You are given a positive integer m. Your task is to generate the first m numbers of the Fibonacci sequence and compute the sum of all even numbers within these m terms.

The Fibonacci sequence is defined as follows:

  • \(F_0 = 0\)
  • \(F_1 = 1\)
  • For \(n \ge 2\), \(F_n = F_{n-1} + F_{n-2}\)

For example, if \(m = 10\), the first 10 Fibonacci numbers are:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34

The sum of even numbers (0, 2, 8, 34) is 44.

inputFormat

The input is provided via stdin and consists of a single integer m (1 ≤ m ≤ 105) which indicates the number of Fibonacci numbers to consider.

outputFormat

Output to stdout the cumulative sum of all even numbers present among the first m Fibonacci numbers.

## sample
1
0

</p>