main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      putStrLn (show (func' n))
      main
 
func :: Int -> Int
func 0 = 1
func 1 = 1
func 2 = 2
func n = (func (n-3)) + (func (n-2)) + (func (n-1))

func' :: Int -> Int
func' n = (days `div` 365) + (min (days `mod` 365) 1)
  where num = func n
        days = (num `div` 10) + (min (num `mod` 10) 1)