Problem link: https://codeforces.com/problemsets/acmsguru/problem/99999/123

```
// #include<bits/stdc++.h>
#include<iostream>
// #define f(a,b) for(int i=a;i<b;i++)
// #define dbg(x); cout<<"\n"<<#x<<": "<<x<<"\n";
#define ret return
using namespace std;
const int MAX=41;
int f[MAX]={0};
int fibo(int k){
if(k==0) ret 0;
if(k==1||k==2) ret (f[k]=1);
if(f[k]) ret f[k];
int m=(k&1)?(k+1)/2:k/2;
f[k]=(k&1)?(fibo(m)*fibo(m)+fibo(m-1)*fibo(m-1)):(2*fibo(m-1)+fibo(k))*fibo(m);
ret f[k];
}
int sum(int k){
ret fibo(k+2)-1;
}
int main(){
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
int k;
cin>>k;
cout<<sum(k)<<"\n";
ret 0;
}
```