#include <cstdio>
int dp[31]={1,1,2};
int main() {
	for(int i=3;i<=30;i++) {
		dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
	}
	int n;
	while(scanf("%d",&n),n) {
		int days=(dp[n]/10)+((dp[n]%10)?1:0);
		int years=(days/365)+((days%365)?1:0);
		printf("%d\n",years);
	}
}