#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;

ll dp[31];
ll memo[31];

ll rec(ll n){
    if(n < 0) return 0;
    if(n < 2) return 1;
    if(memo[n]) return memo[n];
    
    return memo[n] = rec(n - 1) + rec(n - 2) + rec(n - 3);

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    while(true){
        ll n;
        cin >> n;
        
        if(n == 0) return 0;
        
        rep(i,31){
            memo[i] = 0;
        }
        
        cout << rec(n)/3650 + 1<< endl;
    }
}
