import qualified Data.ByteString.Char8 as C import Data.Char import Data.Array.IO main :: IO () main = do s1 <- C.getLine let (n,r1) = nextInt s1 s2 <- C.getLine let a = solve s2 s3 <- C.getLine let (b,r2) = nextInt s3 print $ a - b solve :: C.ByteString -> Int solve ss | C.null ss = 0 | otherwise = x + solve rs where (x,rs) = nextInt ss nextInt :: C.ByteString -> (Int, C.ByteString) nextInt ss | isDigit x || x == '-' = nextInt2 0 ss | otherwise = nextInt $ C.tail ss where x = C.head ss nextInt2 :: Int -> C.ByteString -> (Int, C.ByteString) nextInt2 n ss | C.null ss = (n, ss) | y == '-' = (-z,zs) | isDigit y = nextInt2 (n * 10 + (digitToInt y)) ys | otherwise = (n, ys) where y = C.head ss ys = C.tail ss (z,zs) = nextInt2 0 ys