#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;

int main(){
  vector<ll> dp(31);
  dp[0]=1;
  for(int i=1; i<=30; i++){
    dp[i] += dp[i-1];
    if(i>1)
      dp[i] += dp[i-2];
    if(i>2)
      dp[i] += dp[i-3];
  }
  rep(i,31) dp[i] = ((dp[i]+9)/10+364)/365;
  int n;
  while(cin >> n && n!=0)
    cout << dp[n] << endl;
  return 0;
}
