import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines S = read().rstrip().decode('utf-8') move = {'E':(1,0), 'W': (-1,0), 'S': (0,-1), 'N': (0,1)} x,y = 0,0 for s in S: dx,dy = move[s] x += dx; y += dy answer = (x * x + y * y) ** .5 print(answer)