#include<iostream>
using namespace std;

int main(){

	int n, p[30], s;
	
	p[0] = 1;
	p[1] = 1;
	p[2] = 2;
	p[3] = 4;
	for(int i=4; i<=30; i++){
		p[i] = p[i-1] + p[i-2] + p[i-3];
cout << i << " : " << p[i] << endl;
	}
	for(int i=0; i<30; i++){
		s = p[i] % 3650;
		if(s == 0) p[i] /= 3650;
		else p[i] = (p[i] - s) / 3650 + 1;
	}

	while(cin >> n){
		if(n == 0) break;
		cout << p[n] << endl;
	}

	return 0;

}