"""
    Each new term in the Fibonacci sequence is generated by adding the previous two terms.
    By starting with 1 and 2, the first 10 terms will be:

        1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

    By considering the terms in the Fibonacci sequence whose values do not exceed four million,
    find the sum of the even-valued terms.
"""

limit = 4 * 10 ** 6
last2fib_numbers = [1, 1]
sum_ = 0

while last2fib_numbers[-1] <= limit:
    new_fib_number = sum(last2fib_numbers)
    last2fib_numbers[0] = last2fib_numbers[1]
    last2fib_numbers[1] = new_fib_number
    if new_fib_number % 2 == 0:
        sum_ += new_fib_number

print(sum_)

3263c4d659e188b20f15de65d7df16d34bcb6cdc
<mask token>

<mask token>
while last2fib_numbers[-1] <= limit:
    new_fib_number = sum(last2fib_numbers)
    last2fib_numbers[0] = last2fib_numbers[1]
    last2fib_numbers[1] = new_fib_number
    if new_fib_number % 2 == 0:
        sum_ += new_fib_number
print(sum_)

<mask token>
limit = 4 * 10 ** 6
last2fib_numbers = [1, 1]
sum_ = 0
while last2fib_numbers[-1] <= limit:
    new_fib_number = sum(last2fib_numbers)
    last2fib_numbers[0] = last2fib_numbers[1]
    last2fib_numbers[1] = new_fib_number
    if new_fib_number % 2 == 0:
        sum_ += new_fib_number
print(sum_)

"""
    Each new term in the Fibonacci sequence is generated by adding the previous two terms.
    By starting with 1 and 2, the first 10 terms will be:

        1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

    By considering the terms in the Fibonacci sequence whose values do not exceed four million,
    find the sum of the even-valued terms.
"""

limit = 4 * 10 ** 6
last2fib_numbers = [1, 1]
sum_ = 0

while last2fib_numbers[-1] <= limit:
    new_fib_number = sum(last2fib_numbers)
    last2fib_numbers[0] = last2fib_numbers[1]
    last2fib_numbers[1] = new_fib_number
    if new_fib_number % 2 == 0:
        sum_ += new_fib_number

print(sum_)
