N = []

while 1:

  x = eval(input())

  if x==0: break

  N.append(x)

n0 = max(N)-2

A = [1,1,2]+[0]*n0

for i in range(0, n0): A[i+3] = sum(A[i:i+3])

for e in N: print(A[e]/3650+[0,1][A[e]%3650>0])
N = []

while 1:

  x = int(input())

  if x==0: break

  N.append(x)

n0 = max(N)-2

A = [1,1,2]+[0]*n0

for i in range(0, n0): A[i+3] = sum(A[i:i+3])

for e in N: print((A[e]+3649)/3650)
N = []
while 1:
    x = eval(input())
    if x == 0:
        break
    N.append(x)
n0 = max(N) - 2
A = [1, 1, 2] + [0] * n0
for i in range(0, n0):
    A[i + 3] = sum(A[i : i + 3])
for e in N:
    print(A[e] / 3650 + [0, 1][A[e] % 3650 > 0])

N = []
while 1:
    x = int(input())
    if x == 0:
        break
    N.append(x)
n0 = max(N) - 2
A = [1, 1, 2] + [0] * n0
for i in range(0, n0):
    A[i + 3] = sum(A[i : i + 3])
for e in N:
    print((A[e] + 3649) / 3650)

-    x = eval(input()) +    x = int(input()) -    print(A[e] / 3650 + [0, 1][A[e] % 3650 > 0]) +    print((A[e] + 3649) / 3650)