# -*- coding: utf-8 -*-



class dice_class:

    def __init__(self, top, front, right, left, back, bottom):

        self.top    =   top

        self.front  =   front

        self.right  =   right

        self.left   =   left

        self.back   =   back

        self.bottom =   bottom



    def roll(self, s):

        for i in s:

            if i == 'E':

                self.rollE()

            elif i == 'N':

                self.rollN()

            elif i == 'S':

                self.rollS()

            elif i == 'W':

                self.rollW()



    def rollE(self):

        tmp         =   self.top

        self.top    =   self.left

        self.left   =   self.bottom

        self.bottom =   self.right

        self.right  =   tmp



    def rollN(self):

        tmp         =   self.top

        self.top    =   self.front

        self.front  =   self.bottom

        self.bottom =   self.back

        self.back   =   tmp



    def rollS(self):

        tmp         =   self.top

        self.top    =   self.back

        self.back   =   self.bottom

        self.bottom =   self.front

        self.front  =   tmp



    def rollW(self):

        tmp         =   self.top

        self.top    =   self.right

        self.right  =   self.bottom

        self.bottom =   self.left

        self.left   =   tmp



if __name__ == "__main__":

    a = list(map(int, input().split()))

    s = str(input())

    dice = dice_class(a[0], a[1], a[2], a[3], a[4], a[5])

    dice.roll(s)

    print(dice.top)
# -*- coding: utf-8 -*-



class dice_class:

    def __init__(self, list):

        self.num = list



    def roll(self, s):

        for i in s:

            if i == 'E':

                self.rollE()

            elif i == 'N':

                self.rollN()

            elif i == 'S':

                self.rollS()

            elif i == 'W':

                self.rollW()



    def rollE(self):

        self.num = [self.num[3], self.num[1], self.num[0], self.num[5], self.num[4], self.num[2]]



    def rollN(self):

        self.num = [self.num[1], self.num[5], self.num[2], self.num[3], self.num[0], self.num[4]]



    def rollS(self):

        self.num = [self.num[4], self.num[0], self.num[2], self.num[3], self.num[5], self.num[1]]



    def rollW(self):

        self.num = [self.num[2], self.num[1], self.num[5], self.num[0], self.num[4], self.num[3]]





if __name__ == "__main__":

    dice = dice_class(list(map(int, input().split())))

    s = str(input())

    dice.roll(s)

    print(dice.num[0])
# -*- coding: utf-8 -*-
class dice_class:
    def __init__(self, top, front, right, left, back, bottom):
        self.top = top
        self.front = front
        self.right = right
        self.left = left
        self.back = back
        self.bottom = bottom

    def roll(self, s):
        for i in s:
            if i == "E":
                self.rollE()
            elif i == "N":
                self.rollN()
            elif i == "S":
                self.rollS()
            elif i == "W":
                self.rollW()

    def rollE(self):
        tmp = self.top
        self.top = self.left
        self.left = self.bottom
        self.bottom = self.right
        self.right = tmp

    def rollN(self):
        tmp = self.top
        self.top = self.front
        self.front = self.bottom
        self.bottom = self.back
        self.back = tmp

    def rollS(self):
        tmp = self.top
        self.top = self.back
        self.back = self.bottom
        self.bottom = self.front
        self.front = tmp

    def rollW(self):
        tmp = self.top
        self.top = self.right
        self.right = self.bottom
        self.bottom = self.left
        self.left = tmp


if __name__ == "__main__":
    a = list(map(int, input().split()))
    s = str(input())
    dice = dice_class(a[0], a[1], a[2], a[3], a[4], a[5])
    dice.roll(s)
    print(dice.top)

# -*- coding: utf-8 -*-
class dice_class:
    def __init__(self, list):
        self.num = list

    def roll(self, s):
        for i in s:
            if i == "E":
                self.rollE()
            elif i == "N":
                self.rollN()
            elif i == "S":
                self.rollS()
            elif i == "W":
                self.rollW()

    def rollE(self):
        self.num = [
            self.num[3],
            self.num[1],
            self.num[0],
            self.num[5],
            self.num[4],
            self.num[2],
        ]

    def rollN(self):
        self.num = [
            self.num[1],
            self.num[5],
            self.num[2],
            self.num[3],
            self.num[0],
            self.num[4],
        ]

    def rollS(self):
        self.num = [
            self.num[4],
            self.num[0],
            self.num[2],
            self.num[3],
            self.num[5],
            self.num[1],
        ]

    def rollW(self):
        self.num = [
            self.num[2],
            self.num[1],
            self.num[5],
            self.num[0],
            self.num[4],
            self.num[3],
        ]


if __name__ == "__main__":
    dice = dice_class(list(map(int, input().split())))
    s = str(input())
    dice.roll(s)
    print(dice.num[0])

-    def __init__(self, top, front, right, left, back, bottom): -        self.top = top -        self.front = front -        self.right = right -        self.left = left -        self.back = back -        self.bottom = bottom +    def __init__(self, list): +        self.num = list -        tmp = self.top -        self.top = self.left -        self.left = self.bottom -        self.bottom = self.right -        self.right = tmp +        self.num = [ +            self.num[3], +            self.num[1], +            self.num[0], +            self.num[5], +            self.num[4], +            self.num[2], +        ] -        tmp = self.top -        self.top = self.front -        self.front = self.bottom -        self.bottom = self.back -        self.back = tmp +        self.num = [ +            self.num[1], +            self.num[5], +            self.num[2], +            self.num[3], +            self.num[0], +            self.num[4], +        ] -        tmp = self.top -        self.top = self.back -        self.back = self.bottom -        self.bottom = self.front -        self.front = tmp +        self.num = [ +            self.num[4], +            self.num[0], +            self.num[2], +            self.num[3], +            self.num[5], +            self.num[1], +        ] -        tmp = self.top -        self.top = self.right -        self.right = self.bottom -        self.bottom = self.left -        self.left = tmp +        self.num = [ +            self.num[2], +            self.num[1], +            self.num[5], +            self.num[0], +            self.num[4], +            self.num[3], +        ] -    a = list(map(int, input().split())) +    dice = dice_class(list(map(int, input().split()))) -    dice = dice_class(a[0], a[1], a[2], a[3], a[4], a[5]) -    print(dice.top) +    print(dice.num[0])