import std.stdio;

int[40] ptn;

void main(){
	int n;
	ptn[1..4] = [1, 2, 4];
	for (int i = 3; i < 30; i++) ptn[i+1] = ptn[i] + ptn[i-1] + ptn[i-2];
	while (readf("%d\n", &n), n) writeln((((ptn[n]+9)/10)+364)/365);
}