#include <iostream>
#include <cstring>

int dp(int memo[],int n){
	if(n == 0 || n == 1) return n;
    if(memo[n] != 0) return memo[n];
    memo[n] = dp(memo,n-1)  + dp(memo,n-2);
    return memo[n];
 }
 
 int fib(int N)
 {
 	int *memo = new int[N + 1];
    memset(memo,0,sizeof(int)*(N+1));
    int result = dp(memo,N);
    delete[] memo;
    return result;
 }
 
 int main(void)
 {
	int fib_num = 2;
    std::cout << fib(fib_num) << std::endl;
    return 0;
 }