#include<iostream>
// #include<string>
using namespace std;

int allSearch(int n) {
  int a;
  if(n <= 1) {
    a = 1;
  } else if(n <= 2) {
    a = allSearch(n-2) + allSearch(n-3);
  } else {
    a = allSearch(n-1) + allSearch(n-2) + allSearch(n-3);
  }
  return a;
}

int main() {
  int n;
  while(true){
  cin >> n;
  if(n == 0)break;
  cout << 1 + allSearch(n)/3650 << endl;
  }
}
