#include <iostream>
#include <vector>
using namespace std;

int main() {
    vector<int> dp(31, 0);
    dp[0] = 1;
    for (int i = 1; i <= 30; i++) {
        dp[i] = dp[i - 1];
        if (i >= 2) dp[i] += dp[i - 2];
        if (i >= 3) dp[i] += dp[i - 3];
    }
    int N;
    while (cin >> N, N) {
        cout << ((dp[N] + 10 - 1) / 10 + 365 - 1) / 365 << endl;
    }
    return 0;
}
