#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


int dp[34];
int main(){
int N,x;

  cin >> x;
  dp[0] = 1;
  for(int i = 0; i < 31; i++){

	  dp[i+1] += dp[i];
	  dp[i+2] += dp[i];
	  dp[i+3] += dp[i];

  }

  while(x != 0){

	  cout << dp[x]/3650 + 1 << endl;;

	  cin >> x;
  }


    


	return 0;
}
#include<iostream>

using namespace std;

int main(){

    while(1){
        int n;
        cin>> n;
        if(n==0) break;

        int dp[31];
        fill(dp, dp+31, 0);
        dp[1]=1; dp[2]=2; dp[3]=4;
        for(int i=4; i<=n; i++){
            dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
        }

        cout<< (dp[n]+3650-1)/3650<< endl;
    }

    return 0;
}