#include <bits/stdc++.h>
using namespace std;

int main() {
	vector<int> ans;
	int now=0,ans_now=0;
	vector<int> dp(35);
	int tmp,tmp1,tmp2;
	int a[31];

	//入力
	dp[0] = 1;dp[1] = 1;dp[2] = 2;
	a[0] = a[1] = a[2] = 1;
	for (int i = 3; i <= 33; i++) {
		dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
		//cout <<i<< dp[i-1] <<" "<< dp[i - 2] << " "<< dp[i - 3] << " "<< " c" << endl;
		 //cout << dp[tmp]<<" a"<<endl;
		 //何年かかるか
		tmp1 = dp[i] % 3650;
		tmp2 = dp[i] / 3650;
		if (tmp1 != 0) {
			tmp2++;
		}
		ans.push_back(tmp2);
	}
	cin >> tmp;
	int i = 3;
	 do{
		a[i] = ans[tmp];
		 cin >> tmp;
		 i++;
	 } while (tmp!=0);
	for (int j = 0; j < 30; j++) {
		cout << a[j]<<endl;

	}

	return 0;
}
