#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    vector<long long> dp(n + 1);
    for (int i = 0; i <= n; i++) {
      if (i == 0) dp[i] = 1;
      else if (i == 1) dp[i] = 1;
      else if (i == 2) dp[i] = 2;
      else dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
    }
    cout << ((dp[n] + 9) / 10 + 364) / 365 << endl;
  }
}
