#include <iostream>
#include <vector>
#include <cstdlib>
#include <math.h>
using namespace std;

#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MAX_N = 35;
//const int MAX_V = 100100;

int data[MAX_N]; 

int main(){
    int data_num=0;
    REP(i,MAX_N){
        cin >> data[i];
        data_num++; 
        if(data[i]==0) break;
    }
    int dp[MAX_N];
    dp[1] = 1;
    dp[2] = 2;
    dp[3] = 4;
    FOR(k,4,31){
        dp[k] = dp[k-1] + dp[k-2] + dp[k-3];
    }
    REP(i,data_num-1){
        cout << ceil(dp[data[i]]/3650.0) << endl;
    }
    
}
