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

int n;
long long dp[39];

long long rec(int n) {
  if (dp[n] != 0) return dp[n];
  return dp[n] = rec(n - 1) + rec(n - 2) + rec(n - 3);
}

int main() {
  while (true) {
    int n; cin >> n;
    if (n == 0) break;
    for (int i = 0; i <= n; i++) dp[i] = 0;
    dp[0] = 1, dp[1] = 1, dp[2] = 2, dp[3] = 4;
    
    long long ans = rec(n) / 3650;
    if (rec(n) % 3650 != 0) ans++;
    cout << ans << endl;
  }
  
  return 0;
}

