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 <iomanip>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(void){
	int n;

	
	while(cin >> n && n){
	int a[33];
	a[0] = a[1] = 0;
	a[2] = 1;
	for(int i = 3;i < n+3;i++){
		a[i] = a[i-3] + a[i-1] + a[i-2];
	}
	int res = a[n+2]/10/365;
	if(a[n+2]% 3650 != 0)
		res ++;
	cout << res << endl;
	}
	return 0;
}

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

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

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

int main() {
	// your code goes here
	//0段目...まだ踏み出してない
	//1段目...１通りなのは明らか
	//2段目...1x2か2段でくる
	int n[31]={1,1,2};
	//3段目は0,1,2段目から来る
	//同様に、i段目はi-1,i-2,i-3段目から来る
	for(int i=3;i<=31;i++)n[i]=n[i-1]+n[i-2]+n[i-3];
	int n_steps;
	while(cin>>n_steps, n_steps){
		cout<<n[n_steps]/10/365+1<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
long long int func(long long int x){
	if(x==0)
		return 1;
	else return x*func(x-1);
}
int main(){
	long long int sum,n,k,pre,num;
	while(cin>>n,n){
		sum=0;
		for(long long int i=0;i<=n/3;i++)
		for(long long int j=0;j<=(n-3*i)/2;j++){
			k=n-3*i-2*j;
			num=i+j+k;
			sum+=func(num)/(func(i)*func(j)*func(k));
		}
		pre=sum%3650;
		if(pre>0)
			pre=1;
		else
		pre=0;
		cout<<sum/3650+pre<<endl;
	}
	return 0;
}

C++: #include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<iostream>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

ll gcd(ll a,ll b)
{
   if (a%b == 0) return(b);
   else return(gcd(b,a%b));
}

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(true){
        ll c;
        cin>>c;
        if(c==0) break;
        else{
            vec<ll> dp(c+10,0);
            dp[0]=0;
            dp[1]=1;
            dp[2]=2;
            dp[3]=4;
            for(ll j=4;j<=c;j++){
                dp[j]=dp[j-1]+dp[j-2]+dp[j-3];
            }
            cout<<ceil((double)dp[c]/3650)<<endl;
        }
    }
    return 0;
}

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

int num(int n);

int main(){
  int n;
  cin>>n;
  cout << num(n) <<endl;
}

int num(int n){
    switch (n)
    {
        case 0: return 0;
        case 1:  return 1;
        case 2:  return 2;
        case 3:  return 4;
    }
  return num(n-1)+num(n-2)+num(n-3);
}

C++: #include <iostream>
using namespace std;
#define rep(i,x,to) for(int i=x;i<to;i++)

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

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

#ifdef WIN32
#define dump(x) cout << #x << " = " << (x) << "\n"
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"
#else
#define dump(x)
#define debug(x)
#endif

int n;
int dp[ 31 ];

void solve() {
	CLR( dp );
	dp[ 0 ] = 1;
	for ( int i = 0; i <= n; i++ ) {
		for ( int j = 1; j < 4; j++ ) {
			if ( i - j < 0 ) {
				break;
			}
			dp[ i ] += dp[ i - j ];
		}
	}
	int ans = ( dp[ n ] / 10 + !!( dp[ n ] % 10 ) ) / 365 + !!( ( dp[ n ] / 10 + !!( dp[ n ] % 10 ) ) % 365 );
	cout << ans << "\n";
}

int main() {
	ios::sync_with_stdio( false );
	cin.tie( 0 );
#ifdef WIN32
	srand( ( uint ) time( NULL ) );
	cout << "Debug Mode\n";
	while ( true ) {
		n = rand() % 31;
		cout << n << "\n";
		if ( n == 0 ) {
			break;
		}
		solve();
	}
	return 0;
#endif
	while ( cin >> n && n ) {
		solve();
	}
	return 0;
}