#include<iostream>
using namespace std;

int fib(int n, int num);
int dx[31];

int main(){
	int n;
	dx[1] = 1;
	dx[2] = 2;
	dx[3] = 4;
	while(cin >>n){
		if(n == 0) break;
		int cnt = fib(n, 4), day, year;
		day = cnt / 10;
		if(cnt % 10 != 0) day++;
		year = day / 365;
		if(day % 10 != 0) year++;
		cout <<year <<endl;
	}
	return 0;
}

int fib(int n, int num){
	if(n <= 3){
		return dx[n];
	}
	else if(num <= n){
		dx[num] = dx[num - 3] + dx[num - 2] + dx[num - 1];
		if(num == n){
			return dx[num];
		} else{
			fib(n, ++num);
		}
	}
}