#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long res1[91]; char res2[111][100]; void BigAdd(char *a,char *b,char *s)//a < b needReverse { int i = 0; int d = 0; while(a[i] != '\0') { s[i] = a[i] + b[i] + d - 48; d = 0; if(s[i] >= 58) { s[i] -= 10; d = 1; } ++i; } while(b[i] != '\0') { s[i] = b[i] + d; d = 0; if(s[i] >= 58) { s[i] -= 10; d = 1; } ++i; } if(d == 1) s[i++] = 49; s[i] = '\0'; } int main() { //ios::sync_with_stdio(false); //freopen("F:\\data.txt","r",stdin); memset(res1,0,sizeof(res1)); memset(res2,0,sizeof(res2)); res1[0] = 0; res1[1] = 1; res1[2] = 2; res1[3] = 3; for(int i = 4; i <= 91; ++i) { res1[i] = res1[i-1] + res1[i-2]; } sprintf(res2[0],"%I64d",res1[90]); sprintf(res2[1],"%I64d",res1[91]); reverse(res2[0],res2[0]+strlen(res2[0])); reverse(res2[1],res2[1]+strlen(res2[1])); for(int i = 2; i <= 110; ++i) { BigAdd(res2[i-2],res2[i-1],res2[i]); } for(int i = 1; i <= 110; ++i) { reverse(res2[i],res2[i]+strlen(res2[i])); } int n; while(scanf("%d",&n) != EOF) { if(n == 0) printf("\n"); else if(n <= 90) { printf("%I64d\n",res1[n]); } else { printf("%s\n",res2[n-90]); } } return 0; }