#include <iostream>

using namespace std;

int dp[31];

int main()
{
  int n;

  while (1) {
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < sizeof(dp) / sizeof(int); i++) {
      dp[i] = 0;
    }

    dp[0] = 1;
    dp[1] = 1;
    dp[2] = 2;

    if (n >= 3) {
      for (int i = 3; i <= n; i++) {
        dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
      }
    }

    int day = (dp[n] + 9) / 10;
    int year = (day + 364) / 365;

    cout << year << endl;
  }
}

