#include <iostream>

using namespace std;

int main() {
    int n;
    unsigned long long int dp[31];
    while (true) {
        cin >> n;
        if (n == 0) {
            return 0;
        }
        dp[0] = 1;
        for (int i=1; i<=n; i++) {
            dp[i] = 0;
            if (i >= 3) {
                dp[i] += dp[i-3];
            }
            if (i >= 2) {
                dp[i] += dp[i-2];
            }
            dp[i] += dp[i-1];
        }
        cout << (dp[n]/3650)+(dp[n]%3650 == 0? 0: 1) << endl;
    }
    return 0;
}