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

int main() {
	int n;
	vector<int> a(31);
	a[1] = 1;
	a[2] = 2;
	a[3] = 4;
	for (int i = 4; i < 31; ++i) a[i] = a[i - 3] + a[i - 2] + a[i - 1];
	while (cin >> n, n) cout << (364 + (9 + a[n]) / 10) / 365 << endl;
}
