#include<iostream>

using namespace std;

int main()
{
  int n;
  long long int dp[31]={1,1,2};
  for(int i=3;i<31;i++)
      dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
  for(;cin>>n,n;)
    cout<<(long long int)((dp[n]/3650.0)+0.999999)<<endl;
}