import kotlin.math.max

fun main(arr:Array<String>) {
    val lastPos = readLine()!!.map { getMove(it) }.reduce { acc, unit -> Pos(acc.x + unit.x, acc.y + unit.y ) }
    val ans = Math.sqrt(Math.pow(lastPos.x.toDouble(), 2.toDouble()) + Math.pow(lastPos.y.toDouble(), 2.toDouble()))
    println(ans)
}

fun getMove(dir:Char):Pos {
    val tmp = when {
        dir == 'E' -> Pos(1, 0)
        dir == 'W' -> Pos(-1, 0)
        dir == 'N' -> Pos(0, 1)
        else -> Pos(0, -1)
    }
    return tmp
}
class Pos(var x:Int, var y:Int)