while true
  n = gets.to_i
  break if n == 0

  if n<4
    puts 1
  else
    a = Array.new(n)
    a[0..2] = [1,2,4]
    for i in 3..n-1
      a[i] = a[i-1]+a[i-2]+a[i-3]
    end
    puts (a[-1]/10 +1)/365 +1
  end
end