#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

vector<ll> table;

ll dp(ll n)
{
  if(table.at(n)>0) return table.at(n);
  if(n==0) return 1;
  if(n==1) return 1;
  if(n==2) return 2;
  
  table.at(n)=dp(n-1)+dp(n-2)+dp(n-3);
  return table.at(n);
}


int main() 
{
  table=vector<ll>(31,0);
  while(true)
  {
    ll N; cin>>N;
    if(N==0) break;
    cout<<(((dp(N)-1)/10+1)-1)/365+1<<endl;
  } 
  /*
  rep(i,31)
  {
    if(i!=0) cout<<" ";
    cout<<table.at(i);
  }
  cout<<endl;
  */
  return 0;
}
