#include <bits/stdc++.h> using namespace std; int main() { int a[100] = {1, 1, 2, 4}; for (int i = 4; i <= 90; ++ i) a[i] = a[i - 1] + a[i - 2] + a[i - 3]; int b; cin >> b; while (b) { cout << a[b] << '\n'; cin >> b; } return 0; }