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

using ll = long long;

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