#include <iostream>
using namespace std;
int main(void){
    while(true){
        
        int year=0,n;
        int a[50]={0};
        cin >> n;
        
        if(n==0)    break;
        
        a[1]=1;
        a[2]=2;
        a[3]=4;
        for(int i=4;i<=30;i++){
            a[i]=a[i-1]+a[i-2]+a[i-3];
        }
        
        year=a[n]/3650+1;
        cout << year << endl;
        
    }
}

