#include<iostream>
using namespace std;
int main(){
  long long fibo[31]={0,1,2,4};
  for(int i=4;i<=30;i++){
    fibo[i] = fibo[i-2]+fibo[i-1]+fibo[i-3];
  }
  int n;
  while(cin >> n,n){
    cout << (fibo[n]%3650?fibo[n]/3650+1:fibo[n]/3650) << endl;
  }
}