def euler2(n):
su = 0
lst = []
for i in xrange(1,n,3):
if(i == 1):
res = 2
elif (i == 4):
res = 8
else:
res = 4* lst[-1]+ lst[-2]
if(res < n):
lst.append(res)
else:
break
print sum(lst)
su = 0
lst = []
for i in xrange(1,n,3):
if(i == 1):
res = 2
elif (i == 4):
res = 8
else:
res = 4* lst[-1]+ lst[-2]
if(res < n):
lst.append(res)
else:
break
print sum(lst)