#include<stdio.h> int main() { int f1, f2, f3,f4,n,t; while (scanf("%d", &n) != EOF) { int o = 4; f1 = 3; f2 = 2; f3 = 1; if (n == 0)break; if (n == 1) printf("1\n"); if (n == 2) printf("2\n"); if (n == 3) printf("3\n"); if (n > 3 && n < 55) { while (o<=n) { f4 = f1 + f3; t = f1; f1 = f4; f3 = f2; f2 = t; o++; } printf("%d\n", f4); } } return 0; }