#include<iostream>
#include<cstring>
using namespace std;
int dp[110];
int s;
bool flag;
long long int ans;
int solve(int i);
int main(){
  while(1){
    cin >> s;
    memset(dp, 0, sizeof(dp));
    flag = 0;
    if(s == 0) break;
    ans = solve(0);
    ans /= 10;
    if(!ans) flag = 1;
    if(ans % 365) flag = 1;
    ans /= 365;
    if(flag == 1) ans++;
    cout << ans << endl;
  }
}

int solve(int i){
  if(i == s) return 1;
  if(i > s) return 0;
  if(dp[i] > 0) return dp[i];
  return dp[i] = solve(i + 1) + solve(i + 2) + solve(i + 3);
}