#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 30

int main()
{
	int n = 1, dp[40] = {1};
	rep(i, 31) {
		if (i == 0) continue;
		if (i >= 1) dp[i] += dp[i - 1];
		if (i >= 2) dp[i] += dp[i - 2];
		if (i >= 3) dp[i] += dp[i - 3];
	}
	while (true) {
		cin >> n;
		if (!n) break;
		cout << (dp[n] + 3649)/ 3650 << endl;
	}
}


