#include<iostream>

using namespace std;

int main() {
    long long n[50], p;

	n[0] = 1; 
    n[1] = 1; 
    n[2] = 2;

	for (int i = 3; i < 40; i++) {
		n[i] = n[i - 1] + n[i - 2] + n[i - 3];
	}

	while (1) {
		cin >> p;
		if (p == 0){
            break; 
        }
        
		cout << (n[p] + 3649) / 3650 << endl;
	}
}

