#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n; //nは階段の段数
    int sum[31]; //上り方の種類数
    
    while(true){
        cin >> n;
        if(n == 0) break;
        
        for(int i = 1; i < 31; i++){
            if(i == 1) sum[i] = 1;
            else if(i == 2) sum[i] = 2;
            else if(i == 3) sum[i] = 4;
            else sum[i] = sum[i - 1] + sum[i - 2] + sum[i - 3];
        }
        
        int day, year;
        for(int i = 1; i < 31; i++){
            if(sum[i] % 10 != 0) day = sum[i] / 10 + 1;
            else day = sum[i] / 10;

            if(i == n){
            if(day > 365) year = day / 365 + 1;
            else year = 1;
            }
        }  
        cout << year << endl;
        // if(day > 365) cout << day / 365 + 1 << endl;
        // else cout << "1" << endl;
    }
}


