#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

#define INF 999999999;
#define MOD 1000000007

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N;
unsigned long long int A[35];

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);
    A[0] = 1;
    for(int i=1; i <= 30; i++){
        if(i==1)A[i] = A[i-1];
        else if(i==2)A[i] = A[i-1]+A[i-2];
        else if(i>=3)A[i] = A[i-1]+A[i-2]+A[i-3];
    }
    while(1){
        cin >> N;
        if(N == 0)break;
        cout << (A[N]+3650)/3650<< '\n';
    }

    return 0;
}
