#include<iostream>
#include<cstdlib>
using namespace std;

const int n_MAX = 31;
const int mod = 10 * 365;

int main() {
  int count;
  int data[n_MAX];
  long long dp[n_MAX];

  for (int i = 0; i < n_MAX; ++i) {
    cin >> data[i];
    if (data[i] == 0) {
      count = i;
      break;
    }
  }

  for (int i = 0; i < n_MAX; ++i) {
    dp[0] = 1;
    dp[1] = 1;
    dp[2] = 2;
  }

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

  for (int i = 0; i < count; ++i) {
    int ans = 0;
    if (dp[data[i]] % mod == 0) {
      ans = dp[data[i]] / mod;
    } else {
      ans = (dp[data[i]] / mod) + 1;
    }
    cout << ans << endl;
  }

  return 0;
}

