import Data.Array

main::IO()
main=do
  solver_loop
  return ()

solver_loop::IO()
solver_loop= do
  input<-getLine
  if input == [] then return () else do
    let val = read input ::Int
    let ans = solver val
    if val == 0
      then do
        return ()
      else do
        print ans
        solver_loop

solver:: Int -> Int
solver n = let dparr = array (0,(max n 3)) ((0,1):(1,1):(2,2):[(k,(dparr!(k-1))+(dparr!(k-2))+(dparr!(k-3)))|k<-[3..(max n 3)]]) in
              (div (dparr!n) 3650) + 1