#include <iostream>
using namespace std;

int main() {
  int n, d, y;
  int dp[31] = {0};
  dp[0] = 1;
  for (int i=1; i<=30; i++) {
    for (int j=0; j<3; j++) {
      if (i>j) dp[i] += dp[i-j-1];
    }
  }
  while (1) {
    cin >> n;
    if (!n) break;
    d = (dp[n] + 9) / 10;
    y = (d + 364) / 365;
    cout << y << endl;
  }
  return 0;
}