#include <iostream>

using namespace std;
/** Problem0168 : Kannondou **/
int main()
{
	int n, k[31];
	k[0] = 1; k[1] = 1; k[2] = 2; k[3] = 4;
	for (int i=4; i<31; i++) {
		k[i] = k[i-1] + k[i-2] + k[i-3];
	}
	
	while (cin >> n, n!=0) {
		cout << k[n]/10/365+1 << endl;
	}
	return 0;
}