#include <iostream>
using namespace std;

int main(){
	int pattern[31];
	pattern[0] = 1;
	pattern[1] = 1;
	pattern[2] = 2;
	for(int i = 3; i <= 30; i++){
		pattern[i] = pattern[i-1] + pattern[i-2] + pattern[i-3];
	}
	int n;
	while(cin >> n){
		if(n == 0) break;
		cout << (pattern[n] + 3649) / 3650 << endl;
	}
	return 0;
}