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

int n,dp[31];

int rec(int n){
    if(dp[n] != 0) return dp[n];
    return dp[n] = rec(n-1) + rec(n-2) + rec(n-3);
}

int main(){
    while(cin >> n,n){
        fill(dp,dp+31,0);
        dp[0] = 1; dp[1] = 1; dp[2] = 2;
        cout << rec(n)/3650 + 1<< endl;
    }
}