sumDigit 0 = 0
sumDigit n = (n`mod`10) + (sumDigit (n`div`10))
main = do{
    getContents >>= mapM_ putStrLn . map (show . sumDigit . (read::String->Integer)) . init . fst . break (=="") . lines;   
}