#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_11_A

class Dice
    def initialize(n)
        @numbers = n
    end
    
    def print
        p @numbers
    end
    
    def s
        buf = @numbers[0]
        @numbers[0] = @numbers[4]
        @numbers[4] = @numbers[5]
        @numbers[5] = @numbers[1]
        @numbers[1] = buf
    end
    def n
        buf = @numbers[0]
        @numbers[0] = @numbers[1]
        @numbers[1] = @numbers[5]
        @numbers[5] = @numbers[4]
        @numbers[4] = buf
    end
    def w
        buf = @numbers[0]
        @numbers[0] = @numbers[2]
        @numbers[2] = @numbers[5]
        @numbers[5] = @numbers[3]
        @numbers[3] = buf
    end
    def e
        buf = @numbers[0]
        @numbers[0] = @numbers[3]
        @numbers[3] = @numbers[5]
        @numbers[5] = @numbers[2]
        @numbers[2] = buf
    end
    
    def top
        @numbers[0]
    end
end

d = Dice.new(gets.split.map(&:to_i))
str = gets.chomp
str.chars.each do |c|
    d.s if c == "S"
    d.n if c == "N"
    d.w if c == "W"
    d.e if c == "E"
end
p d.top