Go: package main

import (
	"bufio"
		"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	dp := make([]int , 30)
	dp[0] = 1 // 1段の階段の登り方
	dp[1] = 2 // 2段の階段の登り方
	dp[2] = 4 // 3段の階段の登り方
	for i := 3; i < 30; i++ {
		// n段の階段の登り方は
		// n-1段の階段の登り方+n-2段の階段の登り方+n-3段の階段の登り方
		dp[i] = dp[i-1]+dp[i-2]+dp[i-3] 
	}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		fmt.Println(((dp[n-1]+9)/10+364)/365)
	}
}

C++: #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;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
	int n, p[31];
	p[0] = 1;
	p[1] = 1;
	p[2] = 2;
	for (int i = 3; i < 30; ++i)
	{
		p[i] = p[i-1] + p[i-2] + p[i-3];
	}
	while(1){
		int y;
		cin >> n;
		if(n == 0){
			break;
		}
		y = p[n] / 10 / 365 + 1;
		
		cout << y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;

long long dp[34];

int main()
{
    dp[0] = 1;
    for (int i = 0; i < 30; i++) {
        dp[i+1] += dp[i];
        dp[i+2] += dp[i];
        dp[i+3] += dp[i];
    }

    int n;
    while ( cin >> n, n) {
        cout << dp[n]/3650 + (dp[n]%3650?1:0) << endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
	int n;
	int a[31] = {1,1,2};
	for(int i=3 ; i <= 30 ; i++ ){
		a[i] = a[i-1] + a[i-2] + a[i-3];
	}

	while( cin >> n , n ){
		cout << (a[n]/10/365 + 1) << endl;
	}
}

C++: #include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	unsigned long long dp[100];
	dp[0] = 0;
	dp[1] = 1;
	dp[2] = 2;
	dp[3] = 4;
	rep(i,4,40){
		dp[i] = dp[i-1] + dp[i-2] + dp[i-3];	
		//cout << dp[i] << endl;
	}
	
	int n;
	while( cin >> n ){
		if( dp[n] % 3650 != 0 )
			cout << dp[n] / 3650 + 1 << endl;
		else
			cout << dp[n] / 3650 << endl;
	}

	ret 0;
}

C++: #include <iostream>
using namespace std;

long double factorial ( int x )
{
  if ( x == 0 ) return 1;
  return x * factorial( x-1 );
}

int main()
{
  while (true)
  {
    int n;      //  段数
    cin >> n;
    if ( n == 0 ) break;

    long int pattern = 0;

    for (int a=0; a <= n/3; a++)
    {
      for (int b=0; b <= n/2; b++)
      {
        for (int c=0; c <=n; c++)
        {
          if ( 3*a + 2*b + c == n )
          {
            pattern += factorial( a+b+c ) / 
               factorial(a) / factorial(b) / factorial(c) ;
          }
        }
      }
    }

    long int day = pattern / 10 + ( pattern%10 == 0 ? 0 : 1 );
    long int year = day / 365 + ( day%365 == 0 ? 0 : 1 );
    cout << year << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
using namespace std;

//common

typedef int  i32;
typedef long long i64,ll;
typedef long double ld;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,r) for(int i=(int)l;i<(int)(r);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//config
//#define NDEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T pmod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}
#define nextInt(n) scanf("%d",&n)
#define defInt(n) int n;nextInt(n)
#define nextLong(n) scanf("%lld",&n)
#define defLong(n) ll n;nextLong(n)
#define nextDouble(n) scanf("%lf",&n)

class Main{
public:

    template<typename T,typename S> T ceil(T a,S v){
        return (a+(v-1))/v;
    }
	int N;
	void run(){
	//	ifstream cin("in");
	//	ofstream cout( "out" );	
        vector<ll> dp(31);
        dp[0]=1;
        for(int i=1;i<=30;i++){
            if(i-1>=0)dp[i]+=dp[i-1];
            if(i-2>=0)dp[i]+=dp[i-2];
            if(i-3>=0)dp[i]+=dp[i-3];
        }
        while(true){
            nextInt(N);
			if(N==0)break;

			cout <<ceil(ceil(dp[N],10),365)<<endl;
		}
	}
};
int main(){
	cout <<fixed<<setprecision(13);	
	ios::sync_with_stdio(false);
	Main().run();
	return 0;
}