/* ID: 1292871202 LANG: C++ */ #pragma comment(linker,"/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; const int MAX = 0x7fffffff; const ll LINF = 0x3f3f3f3f3f3f3f3fLL; const ll LMAX = 0x7fffffffffffffffLL; const double eps = 1e-9; const double pi=acos(-1.0); const int maxn = 100000+5; const int maxm = 100000+5; const int mod = 1e9+7; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 struct BigInt { const static int mod = 10000; const static int DLEN = 4; int a[600],len; BigInt() { memset(a,0,sizeof(a)); len = 1; } BigInt(int v) { memset(a,0,sizeof(a)); len = 0; do { a[len++] = v%mod; v /= mod; } while(v); } BigInt(const char s[]) { memset(a,0,sizeof(a)); int L = strlen(s); len = L/DLEN; if(L%DLEN)len++; int index = 0; for(int i = L-1; i >= 0; i -= DLEN) { int t = 0; int k = i - DLEN + 1; if(k < 0)k = 0; for(int j = k; j <= i; j++) t = t*10 + s[j] - '0'; a[index++] = t; } } BigInt operator +(const BigInt &b)const { BigInt res; res.len = max(len,b.len); for(int i = 0; i <= res.len; i++) res.a[i] = 0; for(int i = 0; i < res.len; i++) { res.a[i] += ((i < len)?a[i]:0)+((i < b.len)?b.a[i]:0); res.a[i+1] += res.a[i]/mod; res.a[i] %= mod; } if(res.a[res.len] > 0)res.len++; return res; } void output() { printf("%d",a[len-1]); for(int i = len-2; i >=0 ; i--) printf("%04d",a[i]); printf("\n"); } }; BigInt ans[2005]; void init() { ans[1]=BigInt(1); ans[2]=BigInt(2); for(int i=3; i<=2000; ++i) { ans[i]=ans[i-1]+ans[i-2]; } } int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); //cin.sync_with_stdio(false); //cout.sync_with_stdio(false); init(); int n; while(cin>>n) { if(n==0) { printf("\n"); continue; } ans[n].output(); } return 0; }