#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int step(int s, vector<int> &dp, int n) {
	int cnt = 0;
	if (s == n) return 1;
	for (int i = 1; i <= 3; i++) {
		if (s + i <= n) {
			if (dp[s + i] == -1)
				cnt += step(s + i, dp, n);
			else
				cnt += dp[s + i];
		}
	}
	dp[s] = cnt;
	return cnt;
}

int main(void) {
	int n;
	vector<int> dp;
	vector<int> res;
	dp.resize(31, -1);
	while (cin >> n, n) {
		int cnt = 0;
		for (int i = 1; i <= 3; i++)
			cnt += step(i, dp, n);
		dp.clear();
		dp.resize(31, -1);
		res.push_back(cnt / 10 / 365 + 1);
	}
	for (int i = 0; i < res.size(); i++)
		cout << res[i] << endl;
}
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    for (long double i = N; i > 0; i--) {
        if (sqrt(i) == int(sqrt(i))) {
            cout << int(i) << endl;
            return 0;
        }
    }
}