solve :: String -> Float solve s = let (x,y) = point s in sqrt $ fromIntegral x ^ 2 + fromInteger y ^ 2 where point [] = (0,0) point (x:xs) = let p = case x of 'N' -> (0,1) 'E' -> (1,0) 'W' -> (-1,0) 'S' -> (0,-1) _ -> undefined in assign p (point xs) assign (x1,y1) (x2,y2) = (x1+x2,y1+y2) main :: IO () main = do s <- getLine :: IO String print $ solve s