#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int dp[35];

int rec(int n) {
    if (0 <= dp[n]) return dp[n];
    if (n == 0) return 1;
    int s1 = 0 <= (n - 1) ? rec(n - 1) : 0;
    int s2 = 0 <= (n - 2) ? rec(n - 2) : 0;
    int s3 = 0 <= (n - 3) ? rec(n - 3) : 0;
    dp[n] = s1 + s2 + s3;
    return dp[n];
}

void solve(int n) {
    for (int i = 0; i < 35; ++i) dp[i] = -1;
    int x = rec(n);
    int y = x / 3650;
    int m = x % 3650;
    cout << (y == 0 ? 1 : y + 1) << endl;
}

int main() {
    while(true) {
        int n;
        cin >> n;
        if (n == 0) break;
        solve(n);
    }
    return 0;
}

