import math s=input() C=lambda m:s.count(m) x=C("E") x-=C("W") y=C("N") y-=C("S") print(math.sqrt(x*x+y*y))