#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>

int compare_int(const void* a, const void* b) { return *(int*) a - *(int*) b; }

int n, dp[31];

int func(int p) {
	if (p == n) {
		return 1;
	}
	int cnt = 0;
	for (int i = p + 1; n >= i && 3 + p >= i; i++) {
		if (dp[i] == -1) dp[i] = func(i);
		cnt += dp[i];
	}
	return cnt;
}

int main() {
	while (scanf("%d", &n) != EOF) {
		if (n == 0) return 0;
		memset(dp, -1, sizeof(dp));
		printf("%d\n", ((func(0)+9) / 10 + 364) / 365);
	}
}