s = io.read() n = string.len(s) x = 0 y = 0 for i = 1, n, 1 do c = string.sub(s, i, i) if c == "N" then y = y + 1 elseif c == "E" then x = x + 1 elseif c == "W" then y = y - 1 else x = x - 1 end end d = math.sqrt(x * x + y * y) io.write(string.format("%.5f", d))