#include<iostream>
using namespace std;

long long int memo[100];

long long int solve(int n){

  if(memo[n]) return memo[n];
  if(n == 1) return 1;
  if(n == 2) return 2;
  if(n == 3) return 4;

  return memo[n] = solve(n-1) + solve(n-2) + solve(n-3);
}

int main(){
  int n;

  solve(35);

  while(cin >> n, n) cout << memo[n]/3650+1 << endl;
}