fun main(){
var np = readln().split(" ").map{ it.toInt() }
var n = np[0]
var p = np[1]
var xy = readln().split(" ").map{ it.toInt() }
var x = xy[0]
var y = xy[1]
var m = readln()
while (p > 0) {
when (m) {
"N" -> x -= 1
"S" -> x += 1
"W" -> y -= 1
"E" -> y += 1
"NE" -> {
x -= 1
y += 1
}
"SE" -> {
x += 1
y += 1
}
"SW" -> {
x += 1
y -= 1
}
"NW" -> {
x -= 1
y -= 1
}
}
if (x == n)
x = 0
if (y == n)
y = 0
if (x == -1)
x = n - 1
if (y == -1)
y = n - 1
p--
}
print("$x $y")
}