#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define MOD 1000000007
using namespace std;


int main(){
    int n;
    int dp[31] = {0};
    dp[0] = 1;
    dp[1] = 1;
    dp[2] = 2;
    for (int i = 3; i < 31; i++)
    {
        dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
    }
    
    while(true){
        cin >> n;
        if(n == 0) break;
        int day = (dp[n]-1)/10 + 1;
        int year = (day-1)/365 + 1;
        cout << year << endl;
    }
    return 0;
}
