/*
	AOJ_0173:Kannondou
*/

#include	<iostream>
#include	<utility>
#include	<algorithm>

using namespace std;

/*prototype declaration*/
long long getPattern(int x);

long long dp[30] = {1, 2, 4};

int main() {
	while(1) {
		int a;
		long long gp;
		
		cin >> a;
		if(a == 0) { break; }
		
		gp = getPattern(a);
		if(gp % 3650 != 0) {
			cout << gp / 3650 + 1 << endl;
		} else {
			cout << gp / 3650 << endl;
		}
	}
	return 0;
}

long long getPattern(int x) {
	if(x < 3) {
		return dp[x-1];
	} else {
		if(dp[x-1] != 0) {
			return dp[x-1];
		} else {
			dp[x-1] = getPattern(x-1) + getPattern(x-2) + getPattern(x-3);
			return dp[x-1];
		}
	}
}