main = getLine >>= print . euclid . foldl move (0,0) euclid (x,y) = sqrt ((fromIntegral x)^2 + (fromIntegral y)^2) move (x,y) 'N' = (x,y+1) move (x,y) 'E' = (x+1,y) move (x,y) 'W' = (x-1,y) move (x,y) 'S' = (x,y-1)