
# 1 2 4 8 16 32
# SE

=begin
        1
    4   2   3   5
        6

        0
    3   1   2   4
        5
=end

a = gets.split(" ").map(&:to_i)
s = gets.chomp

s.each_char do |i|
    if i.eql?("N") then
        a[0], a[1], a[5], a[4] = a[1], a[5], a[4], a[0]
    elsif i.eql?("S") then
        a[0], a[1], a[5], a[4] = a[4], a[0], a[1], a[5]
    elsif i.eql?("E") then
        a[0], a[2], a[5], a[3] = a[3], a[0], a[2], a[5]
    elsif i.eql?("W") then
        a[0], a[2], a[5], a[3] = a[2], a[5], a[3], a[0]
    end
end

print a[0], "\n"

