arr = []
n=1
i=0
loop do
  arr.push(gets.chomp.to_i)
  if arr[arr.size-1] == 0
    arr.pop
    arr.each {|i|
      puts 'Case '+n.to_s+': '+i.to_s
      n+=1
    }
    break
  elsif i > 10000
    break
  end
  i+=1
end