#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(ll a,ll b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int year(ll n) {
	return mod(n, 3650);
}

int main() {
  cin.tie(0);  cout.tie(0);
  ios::sync_with_stdio(false);

  int n;
	ll memo[50];
	memo[0] = 1;
	memo[1] = 1;
	memo[2] = 2;
	for(int i = 3; i <= 30; i++) {
		memo[i] = memo[i - 1] + memo[i - 2] + memo[i - 3];
	}
	while(1) {
		cin >> n;
		if(!n) break;
		cout << year(memo[n]) << endl;
	}
  return 0;
}

