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

int main() {
    vector<long long> N(30);
    for (int i = 0; i < 30; i++) cin >> N[i];
    for (int i = 0; i < 30; i++) {
        if (N[i] == 0) break;

        vector<long long> dp(31);
        for (int j = 0; j < N[i]; j++) dp[j] = 0;
        dp[0] = 1;
        for (int j = 1; j <= N[i]; j++) {
            dp[j] += dp[j - 1];
            if (j >= 2) dp[j] += dp[j - 2];
            if (j >= 3) dp[j] += dp[j - 3];
        }
        cout << (((dp[N[i]] + 9) / 10) + 364) / 365 << endl;
    }
}
