#include <iostream>
using namespace std;
int f(int n){
  if(n<0)return 0;
  if(n==0)return 1;
  return f(n-1)+f(n-2)+f(n-3);
}
int main(){
  int n;cin >> n;
      while(1){
        cin >> n;
        if(n==0)
            break;
        int num=f(n);
        cout <<num/10/365+1<< endl;
    }
}