#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX_N = 30;

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

        // initialize DP table
        int dp[MAX_N + 1];
        for (int i = 0; i <= n; i++) dp[i] = 0;

        // initial condition
        dp[0] = 1;

        for (int i = 1; i <= n; i++) {
            dp[i] = dp[i - 1];
            if (i > 1) dp[i] += dp[i - 2];
            if (i > 2) dp[i] += dp[i - 3];
        }

        int year = (dp[n] + 3649) / 3650;
        cout << year << endl;
    }
    return 0;
}
