import Control.Applicative
main = do
  s <- map read . words <$> getLine
  op <- getLine
  putStrLn . show . head $ trans op s
  
trans :: [Char] -> [Int] -> [Int]
trans [] x = x
trans (x:xs) d = case x of
  'E' -> trans xs (opE d)
  'W' -> trans xs (opW d)
  'N' -> trans xs (opN d)
  'S' -> trans xs (opS d)
  
opE :: [Int] -> [Int]
opE [x1,x2,x3,x4,x5,x6] = [x4,x2,x1,x6,x5,x3]

opW :: [Int] -> [Int]
opW [x1,x2,x3,x4,x5,x6] = [x3,x2,x6,x1,x5,x4]

opN :: [Int] -> [Int]
opN [x1,x2,x3,x4,x5,x6] = [x2,x6,x3,x4,x1,x5] 

opS :: [Int] -> [Int]
opS [x1,x2,x3,x4,x5,x6] = [x5,x1,x3,x4,x6,x2]