#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int sum[100][10000]; int main() { int a,b,c,m,n,q; while(~scanf("%d%d%d",&a,&b,&c)){ if(a==0&&b==0&&c==0) { printf("0\n"); continue; } memset(sum,sizeof(sum)); m = n = q = 0; while(a){ sum[0][m++] =a %10; a /= 10; } while(b){ sum[1][n++] = b%10; b /= 10; } while(c){ sum[2][q++] = c%10; c /= 10; } int i,j; for(int i = 3;i < 100; i++){ int x=0,y=0; for( j = 0;j <= 1000; j++ ){ y =x+ sum[i-1][j]+sum[i-2][j]+sum[i-3][j]; sum[i][j]=y%10; x=y/10; } } int t; for( t = 100;t >= 0;t--){ if(sum[99][t]) break; } for(;t>=0;t--) printf("%d",sum[99][t]); printf("\n"); } return 0; }