#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;

int main(){
  vector<ll> dp(40,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,30){
    int n; cin >> n;
    if (n==0) return 0;
    ll day = (dp[n]+9)/10;
    ll year = (day+364)/365;
    cout << year << endl;
  }
 

  // cout << fixed << setprecision(10);
  
  return 0;
}

