#include<stdio.h> #include<string.h> #define N 3100 int a[N],b[N],c[N],d[N],e[N]; int main() { int n,i,j,k,t; while(scanf("%d",&n)!=EOF) { memset(a,0,sizeof(a));memset(c,0,sizeof(c)); memset(b,0,sizeof(b));memset(d,0,sizeof(d)); memset(e,0,sizeof(e)); a[0]=1;b[0]=1;c[0]=1;d[0]=1; if(n==1||n==2||n==3||n==4) { printf("1 "); continue; } for(i=5;i<=n;i++) { k=0; memset(e,0,sizeof(e)); for(j=0;j<=3000;j++) { t=a[j]+b[j]+c[j]+d[j]+k; k=t/10000; e[j]=t%10000; } for(j=0;j<=3000;j++) { a[j]=b[j]; b[j]=c[j]; c[j]=d[j]; d[j]=e[j]; } } k=0; for(i=3000;i>=0;i--) { if(k) printf("%04d",e[i]); else if(e[i]) { k=1; printf("%d",e[i]); } } printf(" "); } return 0; }