$kannondou = [0, 1, 2, 4]
$size = $kannondou.size

def count(n)
  while $size <= n
    $kannondou[$size] = $kannondou[$size-1] + $kannondou[$size-2] + $kannondou[$size-3]
    $size += 1
  end
  $kannondou[n]
end

while n = gets.to_i
  break if n.zero?
  puts count(n) / 3650 + 1
end