#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
 
int main(){
while(1){
int a;
cin>>a;
if(a==0) break;
int dp[33];
dp[0]=1;
dp[1]=1;
dp[2]=2;
if(a<3){
 cout<<1<<endl;
continue;
}
else{
for(int j=3;j<=a;j++){
dp[j]=dp[j-1]+dp[j-2]+dp[j-3];
}
if(dp[a]%10==0) dp[a]/=10;
else dp[a]=(dp[a]+10)/10;
if(dp[a]%365==0) dp[a]/=365;
else dp[a]=(dp[a]+365)/365;
cout<<dp[a]<<endl;
}
}
}
