import sys
number = int(sys.stdin.readline())
memory = {}
def fib(n: int):
if n == 0:
return 0
if n == 1:
return 1
if n == 2:
return 1
if n > 2:
if memory.get(n-2) and memory.get(n-1):
return memory.get(n-2) + memory.get(n-1)
else:
memory[n-2] = fib(n-2)
memory[n-1] = fib(n-1)
return memory.get(n-2) + memory.get(n-1)
print(fib(number))
피보나치 수열의 점화식
F0 = 0
F1 = 1
Fn = Fn-1 + Fn-2 (n>=2)
# 실패하는 피보나치수열 계산 (시간초과)
# 시간복잡도 O(2^n)
def fibonacci(n):
if n == 0:
return 0
if n == 1:
return 1
return fibonacci(n-1) + fibonacci(n-2)
print(fibonacci(int(input()))
n = int(input())
a, b = 0, 1
while n > 0:
a, b = b, a+b
n -= 1
print(a)