#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int R = 1e9 + 7; 

int main() {
    while (1) {
        int n; cin >> n;
        if (n == 0) break;
        ll dp[n + 1];
        dp[0] = 1, dp[1] = 2, dp[2] = 4;
        for (int i = 3; i < n; i++) {
            dp[i] = dp[i - 3] + dp[i - 2] + dp[i - 1];
        } 
        ll ans = (364 + ((dp[n - 1] + 9) / 10)) / 365;
        cout << ans << endl;
    }
    return 0;
}
