#include <iostream>
using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll dp[40] = {};
  dp[0] = 1;
  dp[1] = 2;
  dp[2] = 4;
  for(int i = 3; i < 40; i++) {
    dp[i] = dp[i-1]+dp[i-2]+dp[i-3];
  }

  while(true) {
    int n; cin >> n;
    if(n == 0) break;

    ll day = (dp[n-1]+10-1)/10;
    cout << (day+365-1)/365 << '\n';
  }
  return 0;
}

