Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

func CountPatterns(i int, patternNums []int) int {
	if patternNums[i] != 0 {
		return patternNums[i]
	}
	if i == 0 {
		return 1
	}
	patternNums[i] += CountPatterns(i-1, patternNums)
	if i > 1 {
		patternNums[i] += CountPatterns(i-2, patternNums)
	}
	if i > 2 {
		patternNums[i] += CountPatterns(i-3, patternNums)
	}
	return patternNums[i]
}

func Solve(N int) int {
	patternNums := MakeFilledInts(N+1, 0)
	return (CountPatterns(N, patternNums) + 3649) / 3650
}

func main() {
	for N := scan.Int(); N != 0; N = scan.Int() {
		ans := Solve(N)
		fmt.Println(ans)
	}
}

// --------------------------------------------------------------------------------
// Input

var scan = NewScanner()

type Scanner struct{ *bufio.Scanner }

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 100000000)
	return &Scanner{sc}
}

func (s *Scanner) String() string {
	s.Scan()
	return s.Text()
}

func (s *Scanner) Strings(l int) []string {
	if l == 0 {
		return []string{}
	}
	sl := make([]string, l, l)
	for i := range sl {
		sl[i] = s.String()
	}
	return sl
}

func (s *Scanner) Int() int {
	n, _ := strconv.Atoi(s.String())
	return n
}

func (s *Scanner) Ints(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *Scanner) Int64() int64 {
	n, _ := strconv.ParseInt(s.String(), 10, 64)
	return n
}

func (s *Scanner) BigInt() *big.Int {
	return big.NewInt(s.Int64())
}

func (s *Scanner) BigInts(l int) []*big.Int {
	if l == 0 {
		return []*big.Int{}
	}
	sl := make([]*big.Int, l, l)
	for i := range sl {
		sl[i] = s.BigInt()
	}
	return sl
}

func (s *Scanner) Float64() float64 {
	f, _ := strconv.ParseFloat(s.String(), 64)
	return f
}

func (s *Scanner) Floats64(l int) []float64 {
	if l == 0 {
		return []float64{}
	}
	sl := make([]float64, l, l)
	for i := range sl {
		sl[i] = s.Float64()
	}
	return sl
}

// --------------------------------------------------------------------------------
// Output

const (
	Yes = "Yes"
	No  = "No"

	YES = "YES"
	NO  = "NO"
)

func PrintBool(v bool, trueStr, falseStr string) {
	if v {
		fmt.Println(trueStr)
	} else {
		fmt.Println(falseStr)
	}
}

// --------------------------------------------------------------------------------
// sort.BigIntSlice

type BigIntSlice []*big.Int

func (sl BigIntSlice) Len() int {
	return len(sl)
}

func (sl BigIntSlice) Less(i, j int) bool {
	return sl[i].Cmp(sl[j]) == -1
}

func (sl BigIntSlice) Swap(i, j int) {
	sl[i], sl[j] = sl[j], sl[i]
}

// --------------------------------------------------------------------------------
// Mint

const (
	Mod = 1000000007
)

type Mint int

func NewMint(value int) Mint {
	return Mint((value%Mod + Mod) % Mod)
}

func (x Mint) Add(y Mint) Mint {
	if v := x + y; v >= Mod {
		return v - Mod
	} else {
		return v
	}
}

func (x Mint) Sub(y Mint) Mint {
	if v := x + Mod - y; v >= Mod {
		return v - Mod
	} else {
		return v
	}
}

func (x Mint) Mul(y Mint) Mint {
	return (x * y) % Mod
}

func (x Mint) pow(n int) Mint {
	if n == 0 {
		return Mint(1)
	}
	a := x.pow(n >> 1)
	a = a.Mul(a)
	if n&1 != 0 {
		a = a.Mul(x)
	}
	return a
}

func (x Mint) Inverse() Mint {
	return x.pow(Mod - 2)
}

func (x Mint) Div(y Mint) Mint {
	return x * y.Inverse()
}

func (x Mint) Neg() Mint {
	return NewMint(int(-x))
}

// --------------------------------------------------------------------------------
// Factorial

type Factorial struct {
	fact        []Mint
	factInverse []Mint
}

func NewFactorial(n int) *Factorial {
	f := new(Factorial)
	f.init(n)
	return f
}

func (f *Factorial) init(n int) {
	fact := make([]Mint, n+1, n+1)
	fact[0] = NewMint(1)
	for i := 1; i <= n; i++ {
		fact[i] = fact[i-1].Mul(NewMint(i))
	}

	inv := make([]Mint, n+1, n+1)
	inv[n] = fact[n].Inverse()
	for i := n; i >= 1; i-- {
		inv[i-1] = inv[i].Mul(NewMint(i))
	}

	f.fact = fact
	f.factInverse = inv
}

func (f *Fa

Python: while True:
  n = int(input())
  if n == 0:
    break
  ls = [0 for i in range(50)]
  ls[0] = 1
  for i in range(30):
    ls[i+1] += ls[i]
    ls[i+2] += ls[i]
    ls[i+3] += ls[i]
  print( (ls[n] // 3650) + (ls[n] % 3650 != 0) )

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]
                
for i in range(30):
    a=input(int())
    if a==0:
        break
    else:
        print(-((-fib(a)//10)//365))

Python: while True:
    N = int(input())
    if N == 0:
        exit()
    elif N == 1:
        print(1)
    elif N == 2:
        print(1)
    else:
        dp = [0 for i in range(0, N+1)]
        dp[0] = 1
        dp[1] = dp[0]
        dp[2] = dp[0]+dp[1]
        for i in range(3, N+1):
            dp[i] = dp[i-3]+dp[i-2]+dp[i-1]
        ans = dp[N]//3650
        if dp[N] % 3650 == 0:
            print(ans)
        else:
            print(ans+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) + (a[n] % 3650 != 0))

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

Python: import sys,math
a=list(map(int,sys.stdin.read().split()))
a.pop(-1)

for n in a:
  dp=[0]*35
  dp[0]=1
  for i in range(n+1):
    for j in [+1,+2,+3]:
      dp[i+j]+=dp[i]
  print(math.ceil(dp[n]/3650))

Python: a=[1,1,2]
for i in range(3,31): a.append(sum(a[-3:]))
while 1:
    n=int(input())
    if n==0:break
    print((3649+a[n])//3650)

Python: import math
a = []
while True:
    ai = int(input())
    if ai == 0:
        break
    a.append(ai)
for i in range(len(a)):
    dp = [0] * (a[i] + 10)
    dp[0] = 1
    dp[1] = 1
    dp[2] = 2
    for j in range(3, a[i] + 1):
        dp[j] = dp[j - 1] + dp[j - 2] + dp[j - 3]
    #print(dp)
    print(math.ceil(dp[a[i]] / 3650))

Python: import math
 
ans = [0 for i in range(31)]
ans[0] = 1
ans[1] = 1
ans[2] = 2
for i in range(3, 31):
    ans[i] = ans[i-1] + ans[i-2] + ans[i-3]
 
while True:
    N = int(input())
    if N == 0:
        break
 
    print(math.ceil(ans[N]/3650))

Python: import functools


@functools.lru_cache(maxsize=None)
def rec(i):
    if i <= 0:
        return i == 0
    return rec(i-1) + rec(i-2) + rec(i-3)

while True:
    N = int(input())
    if not N:
        break
    print(rec(N)//3650+1)

Python: b=True
l=[1,1,2,4]
def year(n):
  if n%3650==0:
    return n//3650
  else:
    return n//3650+1
while b==True:
  n=int(input())
  if n==0:
    b=False
    break
  else:
    if len(l)>n:
      pass
    else:
      while len(l)!=1+n:
        l.append(l[-1]+l[-2]+l[-3])
    print(year(l[n]))

Python: from math import ceil

a = [0, 1, 2, 4] # n = 0 ??? 3 ????????§??°??????
while True:
    n = int(input())
    if n == 0:
        break
    for i in range(len(a), n+1):
        a.append(a[-3] + a[-2] + a[-1])
    print( int(ceil(a[n]/3650)) )

Python: dp=[0]*31
dp[0]=1
for i in range(0,30):
    if i<30 :
        dp[i+1]+=dp[i]
    if i<29 :
        dp[i+2]+=dp[i]
    if i<28 :
        dp[i+3]+=dp[i]
while True:
    n=int(input())
    if n==0:
        break
    print((dp[n]//3650)+1)