#include <iostream>
#include <map>
using namespace std;

long long dp[35];
int main()
{
	for (auto &x : dp) x = 0;
	dp[0] = 1;
	dp[1] = 1;
	dp[2] = 2;
	for (int i = 3; i < 31; i++){
		dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
	}
	while (1){
		int n;
		cin >> n;
		if (n == 0) return 0;
		cout << dp[n] / 3650 + (dp[n]%3650 ? 1 : 0) << endl;
	}
}

