#include<iostream>
using namespace std;

int main(){
	int n=1;
	int a = 0;
	int f = 0;
	int quest[10000] = { 1 };
	double ans[10000];
	int checkc = 0;
	int i = 4;
	double check[3] = { 1, 2, 4 };
	
	do{
		cin >> quest[a];
		a++;
	} while (quest[a-1] != 0);
	while (a > f+1){
		switch (quest[f]){
		case 1:
			ans[f] = 1;
			break;
		case 2:
			ans[f] = 2;
			break;
		case 3:
			ans[f] = 4;
			break;
		default:
			while (quest[f] >= i){
				ans[f] = check[0] + check[1] + check[2];
				i++;
				check[0] = check[1];
				check[1] = check[2];
				check[2] = ans[f];
			}
		}

		ans[f] = ans[f] / 3650;
		checkc = (int)(ans[f]);

		if (ans[f] > (double)(checkc)){
			checkc++;
		}
		if (ans[f] != 0){
			cout << checkc << endl;
		}
		else{
			cout << endl;
		}
		f++;
	}
	return 0;
}
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <utility>
#include <set>
#include <cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))
using namespace std;
typedef pair<int,int> point;
typedef complex<double> P;
typedef long long ll;

const double eps = 1e-8;
const double INF = 1e12;


double dot(P a,P b){
	return a.real()*b.real()+a.imag()*b.imag();
}
double cross(P a,P b){
	return a.real()*b.imag()-a.imag()*b.real();
}

bool is_orthogonal(P a1,P a2,P b1,P b2){
	return EQ(dot(a1-a2,b1-b2),0.0);
}
bool is_parallel(P a1,P a2,P b1,P b2){
	return EQ(cross(a1-a2,b1-b2),0.0);
}

bool is_point_on_line(P a,P b,P c){
	return EQ(cross(b-a,c-a),0.0);
}

bool is_point_on_linesegment3(P a,P b,P c){
	//|a-c| + |c-b|<=|a-b| ???????????????
	return (abs(a-c)+abs(c-b)<abs(a-b)+EPS);
}

double distance_l_p(P a,P b,P c){
	return abs(cross(b-a,c-a))/abs(b-a);
}


double distance_ls_p(P a,P b,P c){
	if(dot(b-a,c-a)<EPS)return abs(c-a);
	if(dot(a-b,c-b)<EPS)return abs(c-b);
	return abs(cross(b-a,c-a))/abs(b-a);
}

int main(){
	long long dt[50];
	rep(i,50)dt[i]=0;
	dt[1]=1;
	dt[2]=1;
	dt[3]=1;
	rep(i,30){
		dt[i+1]+=dt[i];
		dt[i+2]+=dt[i];
		dt[i+3]+=dt[i];
	}
	int n;
	while(cin>>n,n){
		if(dt[n]%3650!=0)cout<<dt[n]/3650+1<<endl;
		else cout<<dt[n]/3650<<endl;
	}
	return 0;
}