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: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0168

"""
import sys
from sys import stdin
from math import ceil
input = stdin.readline


def solve(n):
    dp = [[0] * (n+1) for _ in range(n+1)]
    for i in range(min(n+1, 4)):
        dp[0][i] = 1

    for i in range(1, n+1):
        for j in range(n+1):
            if j <= i:
                dp[i][j] = 0
            else:
                t = 0
                for k in range(1, min(j, 4)):
                    t += dp[i-1][j-k]
                dp[i][j] = t

    total = 0
    for d in dp:
        total += d[-1]
    return total


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break

        result = solve(n)
        print(ceil(result / 365 / 10))


if __name__ == '__main__':
    main(sys.argv[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: stair = [1, 1, 2]
for i in range(3, 31):
    stair.append(stair[i-1] + stair[i-2] + stair[i-3])

while 1:
    n = int(input())
    if n == 0:
        break

    print((stair[n]+3649) // 3650)

Python: while True:
    N=int(input())
    if N==0:break
        
    D=[0]*(N+1)
    D[0]=1

    for i in range(1,N+1):
     D[i]=(D[i-1]+D[i-2]+D[i-3])
    print( int(-((-D[-1]/10)//365)))

Python: def resolve():
	do = True
	while do:
		s = int(input())
		if not s:
			break
		dp = [-1]*(s+1)
		for i in range(s+1):
			if i == 0 or i == 1:
				dp[i] = 1
				continue
			t = []
			for j in range(1, 4):
				if i - j >= 0:
					t.append(dp[i-j])
			dp[i] = sum(t)
		r = 1 if dp[-1] % (10*365) else 0
		print(dp[-1] // (10*365) + r)
resolve()

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: def fib(n):
    n=int(n)
    F=[1,1,2]
    if n>=3:
        for j in range(2,n):
            F.append(F[j-2]+F[j-1]+F[j])
    return F[n]
                
a=input(int())
if a==0:
    break
else:
    print(-((-fib(a)//10)//365))

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: #coding:utf-8
from __future__ import division,print_function
try:
    input = raw_input
except NameError:
    pass
# 上記のコードはPython2とPython3の違いを一部吸収するためのもの
memo=[0]*31
def solve(x):
    if memo[x]==0:
        if x>1:
            memo[x]=solve(x-1)+solve(x-2)+solve(x-3)
            return memo[x]
        elif x==0:
            memo[x]=1
            return 1
        else:
            return 0
    else:
        return memo[x]

def main():
    while True:
        inp=int(input())
        if inp==0:
            break
        print(solve(inp))

main()

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

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0168

"""
import sys
from sys import stdin
from math import ceil
input = stdin.readline

dp = 0
def solve(n):
    global dp
    dp = [[0] * (n+1) for _ in range(n+1)]
    dp[0][0] = 1

    for i in range(1, n+1):
        for j in range(i, n+1):
            t = 0
            for k in range(1, min(j+1, 3+1)):
                t += dp[i-1][j-k]
            dp[i][j] = t

    total = 0
    for d in dp:
        total += d[-1]
    return total


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break

        result = solve(n)
        print(ceil(result / 365 / 10))


if __name__ == '__main__':
    main(sys.argv[1:])

Python: def main():
    from math import ceil
    N = int(input())
    while N != 0:
        dp = [0] * (N+1)
        dp[0] = 1
        for i in range(1, N + 1):
            res = 0
            for j in range(1, 4):
                if i-j < 0:
                    continue
                res += (dp[i - j])
            dp[i] = res
        print(ceil(ceil(dp[-1]/10) / 365))
        N = int(input())


if __name__ == '__main__':
    main()

Python: dp = [0] * 50
dp[0] = 1
for i in range(30):
  dp[i + 1] += dp[i]
  dp[i + 2] += dp[i]
  dp[i + 3] += dp[i]

while True:
  n = input()
  if n == 0:
    break
  print ((dp[n] + 9) / 10 + 364) / 365

Python: '''
DPで解く
'''
# DPテーブル
dp = [0] * 31

# 初期値
dp[0] = 1
dp[1] = 1
dp[2] = 2

# dp[30]までの値を記録
for i in range(3, 31):
    dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]

while True:
    n = int(input())
    if n == 0:
        break
    # 解を出力
    ans = 1 + dp[n] // (365 * 10)
    print(ans)

Python: def inpl(): return list(map(int, input().split()))

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

Python: a = []
a[:4] = [0, 1, 2, 3]
inList = []
while True:
    n = int(input())
    if n == 0:
        break
    inList.append(n)
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: N = []
while 1:
  x = int(raw_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

Python: #!/usr/bin/env python
# -*- coding: utf-8 -*-

dp = [0 for i in range(31)]
dp[1] = 1
dp[2] = 1
dp[3] = 1

for i in range(1,31):
    for j in range(1,4):
        if i-j > 0:
            dp[i] += dp[i-j]

while True:
    N = int(raw_input())
    if N == 0:
        break
    print(int(dp[N]/10//365)+1)

Python: import math

def cal_pattern(n):
  dp = [0]*(n+1)
  dp[0] = 1
  dp[1] = 1
  if n == 1: return dp[-1]
  dp[2] = 2
  for i in range(3, n+1):
    dp[i] = dp[i-1]+dp[i-2]+dp[i-3]
  return dp[-1]

def run(n):
  patterns = cal_pattern(n)
  days = math.ceil(patterns/10)
  print(math.ceil(days/365))
  
if __name__ == '__main__':
  while True:
    n = int(input())
    if n == 0: break
    run(n)