import sequtils,strutils,math var S = stdin.readline x,y : int ans : float for s in S: case s of 'N': y += 1 of 'E': x += 1 of 'W': x -= 1 of 'S': y -= 1 else: discard if x != 0: ans = x.abs.float * sqrt(1 + pow(y / x, 2)) else: ans = y.abs.float echo ans