"""(c) WhiZTiM   -------- ionogu(<_at_>)acm.org"""

"""Very Fast reusable and Dynamic Fibonacci calculator """
class Fibonacci:
	def __init__(self):
		self.memory = [0, 1, 1]
	def compute(self, n):
		if n < len(self.memory):
			return self.memory[n]
		c1 = self.compute(n - 1)
		c2 = self.compute(n - 2)
		self.memory.append(c1 + c2)
		return c1 + c2

def solve(limit):
	fib = Fibonacci(); rtn = []
	for x in range(limit):
		n = fib.compute(x)
		if n > limit: return rtn
		if n % 2 == 0: rtn.append(n)

print(sum(solve(4000000)))