#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	ll dp[35]={0};
	dp[1]=1ll,dp[2]=2ll,dp[3]=4ll;
	for(int i=4;i<33;i++)
	{
		dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
	}
	int n;
	while(1)
	{
		cin >> n;
		if(n==0)break;
		ll day=dp[n]/10+(dp[n]%10!=0);
		ll year=day/365+(day%365!=0);
		cout << year << endl;
	}
	return 0;
}