main = readAndDo showCase isEnd 1

readAndDo fn fin depth = do
  line <- getLine
  if fin line then return ()
  else do
    fn (show depth) line
    readAndDo fn fin $ depth + 1

-- 終了判定関数
isEnd line = line == "0"

-- 毎行実行する関数
showCase s1 s2 = do
  putStrLn $ "Case " ++ s1 ++ ": " ++ s2

