import Data.Char (intToDigit, digitToInt, isHexDigit, toUpper) import Numeric (showIntAtBase, readInt) toBase :: Int -> Int -> String toBase num base = showIntAtBase base intToDigit num "" fromBase :: String -> Int -> Int fromBase str base = fst $head $readInt base isHexDigit digitToInt str main=interact$unlines.map(f.words).lines f a=map toUpper$toBase (sum$map(\x->fromBase x 12)a) 12