m = gets.split
r = [1, 2, 6, 5]
c = [1, 3, 6, 4]

for i in gets.split("")
    case i
    when "E"
        c.unshift(c.pop)
        r[0] = c[0]
        r[2] = c[2]
    when "N"
        r.push(r.shift)
        c[0] = r[0]
        c[2] = r[2]
    when "S"
        r.unshift(r.pop)
        c[0] = r[0]
        c[2] = r[2]
    when "W"
        c.push(c.shift)
        r[0] = c[0]
        r[2] = c[2]
    end
end

puts m[r[0] -1]
