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

int main() {
  int dp[31];
  dp[0] = dp[1] = 1;
  dp[2] = 2;
  for(int i = 3; i <= 30; i++) {
    dp[i] = dp[i-3] + dp[i-2] + dp[i-1];
    // fprintf(stderr, "dp[%d] = %d\n", i, dp[i]);
  }
  for(int tci = 0; ; tci++) {
    int n; scanf("%d", &n); if(n==0) break;
    printf("%d\n", dp[n]/3650+!!(dp[n]%3650));
  }
  return 0;
}