#include<bits/stdc++.h>
using namespace std;

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    lint d[40];
    d[0] = 1;
    d[1] = 1;
    d[2] = 2;
    REP(p, 3, 40){
        d[p] = d[p-3] + d[p-2] + d[p-1];
    }
    int n;
    while(cin >> n, n){
        lint day = (d[n] - 1) / 10 + 1;
        lint year = (day - 1) / 365 + 1;
        cout << year << endl;
    }
    return 0;
}
