Go: package main

import (
	"bufio"
		"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	dp := make([]int , 30)
	dp[0] = 1 // 1段の階段の登り方
	dp[1] = 2 // 2段の階段の登り方
	dp[2] = 4 // 3段の階段の登り方
	for i := 3; i < 30; i++ {
		// n段の階段の登り方は
		// n-1段の階段の登り方+n-2段の階段の登り方+n-3段の階段の登り方
		dp[i] = dp[i-1]+dp[i-2]+dp[i-3] 
	}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		fmt.Println(((dp[n-1]+9)/10+364)/365)
	}
}

Python: a = []
a[:4] = [0, 1, 2, 3]
inList = []
while True:
    price = int(input())
    if price == 0:
        break
    inList.append(int(input()))
n = max(inList)
for i in range(4, n + 1):
    a[i] = a[i-1] + a[i-2] + a[i-3]
for i in inList:
    print((a[i] // 3650) + (a[i] % 3650 != 0))

Python: import itertools,math,sys
def I(): return int(sys.stdin.readline().rstrip())
dp = [0]*31
dp[0],dp[1],dp[2] = 1,1,2
for i,j in itertools.product(range(3,31),[1,2,3]):
    dp[i] += dp[i-j]
while 1:
    n = I()
    if n==0:
        break
    print(math.ceil(dp[n]/10/365))

Python: while True:
   n=int(input())
   if n==0:
      break
   else:
      if n==1:
           print(1)
      elif n==2:
           print(1)
      else:
        A=[0]*(n+1) #地面が１なのでｎ段目までは要素がｎ+1
        A[0]=1
        A[1]=1
        A[2]=2
        for i in range(3,(n+1)): #1が3からnまで変化する
          A[i]=A[i-1]+A[i-2]+A[i-3]
        print((A[n])//3650+1)

Python: MAXN = 30
dp = [0] * (MAXN+1)
dp[1] = 1
dp[2] = 2
dp[3] = 4
for i in range(4,MAXN+1):
    dp[i] = dp[i-1] + dp[i-2] + dp[i-3]

while True:
    N = int(input())
    if N == 0: break
    print((dp[N]-1) // 3650 + 1)

Python: while True:
    n = int(input())
    if n == 0 : 
        break
    else :
        A = [0]*(n+10)
        A[0] = 1
        A[1] = 1
        A[2] = 2
        for i in range (3,n+1):
            A[i] = A[i-1] + A[i-2] + A[i-3]
        print(A[n]//3650 + 1)

Python: while 1:
    n = int(input())
    if n == 0:break
    A = [1 for _ in range(30)]
    for i in range(1, n + 1):
        A[i] = A[i - 1]
        if i > 1:
            A[i] += A[i - 2]
        if i > 2:
            A[i] += A[i - 3]
    print(A[n] // 3650 + 1)

Python: while True:
    n=int(input())
    if n==0:
        break
    else:
        A=[0]*31
        A[0]=1
        A[1]=1
        A[2]=2
        for i in range(3,n+1):
            A[i]=A[i-1]+A[i-2]+A[i-3]
        print(A[n]//3650+1)

Python: a = [1, 1, 2]
for i in range(3, 31):
    a.append(sum(a[-3:]))

while True:
    n = int(input())
    if not n:
        break
    print(((a[n] + 9) / 10 + 364) / 365)

Python: while True:
    n= int(input())
    if n==0:
        break

    a=[1,1,2,4]
    for i in range(4,n+1):
        a.append(a[i-1]+a[i-2]+a[i-3])
    if a[n] % 3650 ==0:
        print(a[n]/3650)
    else:
        print(a[n]//3650 +1 )

Python: def up(n):
	if n == 0: return 1
	if n < 0: return 0
	return up(n-1)+up(n-2)+up(n-3)
	
while True:
	n = int(raw_input())
	if n == 0: break
	print (up(n)//10+1)//365+1

Python: n = 30
dan_lis = [0] * n
dan_lis[0] = 1
dan_lis[1] = 2
dan_lis[2] = 4
for i in range(n - 3):
    dan_lis[i + 3] = dan_lis[i + 2] + dan_lis[i + 1] + dan_lis[i]
while True:
    n = int(input())
    if n == 0:
        break
    ans = dan_lis[n - 1]/10/365
    print(int(ans + 1))

Python: n = int(input())
st = [1,2,4]
for i in range(n-3):
    s = st[-1] + st[-2] + st[-3]
    st.append(s)
while (n != 0):
    pn = st[n-1]
    if (pn%10 == 0):
        pn //= 10
    else:
        pn = pn//10 + 1

    if (pn%365 == 0):
        pn //= 365
    else:
        pn = pn//365 + 1
    print(pn)
    n = int(input())
    st = [1,2,4]
    for i in range(n-3):
        s = st[-1] + st[-2] + st[-3]
        st.append(s)

Python: l = [ 0 for i in range(33)]
l[0] = 1
l[1] = 1

def f(n):
    if n == 2:
        if l[n] != 0:
            return l[2]
        else:
            l[2] = l[0] + l[1]
            return l[0] + l[1]
    elif n < 2:
        return l[n]
    else:
        if l[n] != 0:
            return l[n]
        else:
            l[n] = f(n-1) + f(n-2) + f(n-3)
            return l[n]
        
while True:
    n = int(input())
    if n == 0:
        exit()
    else:

        print(f(n)//3650+1)

Python: #!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input
a=[1,1,2]
for i in range(3,31): a.append(a[i-1]+a[i-2]+a[i-3])
while True:
	n=int(raw_input())
	if n==0: break
	print((a[n]+3649)//3650)

Python: A = [0 for _ in range(32)]
A[0] = 1
for i in range(1, 32):
    A[i] = A[i-1]
    if i > 1:
        A[i] += A[i-2]
        if i > 2:
            A[i] += A[i-3]

while True:
    n = int(input())
    if n ==0:
        break
    else:
        print(A[n]//3650 + 1)

Python: while True:
    n = int(input())
    if n == 0: break
    a = list(range(n+1))
    a[:4] = [1, 1, 2, 4]
    for i in range(4, n+1):
        a[i] = a[i-1] + a[i-2] + a[i-3]
    print(a[n]//3650 + bool(a[n]%3650))

Python: for i in range(31):
    n = int(input())
    if n == 0:
        break

    d = [1, 1, 2, 4]
    for i in range(4, n+1):
        d.append(d[i-3] + d[i-2] + d[i-1])

    q, r = divmod(d[n], 3650)

    print(q if r == 0 else q + 1)

Python: from math import ceil

INF = int(1e18)
DP = [INF for _ in range(32)]
DP[1] = 1
DP[2] = 1
DP[3] = 2
for i in range(4, 32):
    DP[i] = DP[i - 1] + DP[i - 2] + DP[i - 3]

# print(DP[1:])
while True:
    n = int(input())
    if n == 0:
        break

    print(ceil(DP[n + 1] / 3650))

Python: # AOJ 0168 Kannondou
# Python3 2018.6.18 bal4u

ans = [	0,  1,  2,  4,  7,  13,  24,  44,  81,  149, \
274,  504,  927,  1705,  3136,  5768,  10609,  19513,  35890,  66012, \
121415,  223317,  410744,  755476,  1389537,  2555757,  4700770,  8646064, \
15902591,  29249425, 53798080 ]

while True:
	n = int(input())
	if n == 0: break
	print((ans[n]-1)//3650 + 1)

Python: def kannondou(x):
    dp = [0]*(x+1)
    dp[0] = 1
    for i in range(1, x+1):
        for j in range(1, 4):
            if 0 <= i - j:
                dp[i] += dp[i-j]
    return dp[-1]//3650 + 1

while True:
    a = int(input())
    if a == 0:
        break
    print(kannondou(a))

Python: while True:
    n=int(input())
    if n==0:
        break
    else:
#A(0)=1 A(1)=1 A(2)=2 An=A(n-1)+A(n-2)+A(n-3)
        A=[0]*40
        A[0]=1
        A[1]=1
        A[2]=2
        for i in range (3,31):
            A[i]=A[i-1]+A[i-2]+A[i-3]
        if A[n]%3650==0:
            print(A[n]//3650)
        else:
            print((A[n]//3650)+1)

Python: A=[1,2,4]
for i in range(3,30):
  A.append(A[i-1]+A[i-2]+A[i-3])

while True:
  n=int(input())
  if n==0:
    break
  print(A[n-1]//3650+1)

Python: import sys

dp = [0] * 31
dp[0] = dp[1] = 1
dp[2] = 2

for i in range(3,31):
	dp[i] = dp[i-1] + dp[i-2] + dp[i-3]

for n in sys.stdin:
	n = int(n)
	if n == 0:
		break
	else:
		print((3649+dp[n])//3650)

Python: while True:
    n =int(input())
    if n==0:
        break
    A=[0]*32
    A[0]=0
    A[1]=1
    A[2]=2
    A[3]=4
    for i in range(4,31):
        A[i]=A[i-1]+A[i-2]+A[i-3]
    a=A[n]//3650+1
    print(a)

Python: while True:
    n=int(input())
    if n==0:
        break
    else:
        if n==1:
            print(1)
        elif n==2:
            print(1)
        else:
            A=[0]*(n+1)
            A[0]=1
            A[1]=1
            A[2]=2
            for i in range(3,n+1):
                A[i]=A[i-1]+A[i-2]+A[i-3]
            print(A[n]//3650+1)