main = do
    ints <- getInts
    printResult ints

getInts :: IO [Int]
getInts = do
    str <- getLine
    let ints =  map (\x -> read [x]) str :: [Int]
    return ints

printResult :: [Int] -> IO ()
printResult ns
    | ns !! 0 == 0 = return ()
    | otherwise = do
        putStrLn $ show $ sum ns
        main