#include<iostream>
#include<cstdio>
using namespace std;

class Dice_c{

private:
  int me[4];
  int topbot[2]; // top,bottom

public:
  void Input();
  void Roll(char c);
  void Output();

};


int main(){

  Dice_c dice;
  char com;

  dice.Input();
 
  while(1){
    scanf("%c",&com);

    if(com=='\n')
      break;

    dice.Roll(com);

  }
  
  dice.Output();

  return 0;
}


///////////////////////////////////////




void Dice_c::Input(){

  cin >> me[1] >> topbot[1] >> me[2] >> me[0] >> topbot[0] >> me[3];
  getchar();

}

void Dice_c::Roll(char c){

  int tmp;

  if(c == 'W'){
    tmp = me[0];
    me[0]=me[1] , me[1]=me[2] , me[2]=me[3] , me[3]=tmp;
  }
  else if(c == 'E'){
    tmp = me[3];
    me[3]=me[2] , me[2]=me[1] , me[1]=me[0] , me[0]=tmp;
  }
  else if(c == 'N'){
    tmp = topbot[1];
    topbot[1]=me[3] , me[3]=topbot[0] , topbot[0]=me[1] , me[1]=tmp;
  }
  else{
    tmp = topbot[0];
    topbot[0]=me[3] , me[3]=topbot[1] , topbot[1]=me[1] , me[1]=tmp;
  }

  
  /*
  cout << "  " << topbot[0] << endl;
  for(int i=0; i<4; i++)
    cout << me[i] << ' ';
  cout << endl << "  " << topbot[1] << endl;
  */

}


void Dice_c::Output(){

  cout << me[1] << endl;

}
#include <iostream>
#include <string>
using namespace std;

class Dice{
	int top, n, s, e, w;
public:
	Dice();
	void roll(char dir);
	int getTop();
};

Dice::Dice(){
	top = 1;
	n = 5;
	s = 2;
	e = 3;
	w = 4;
}

void Dice::roll(char dir){
	switch (dir){
	case 'N':
		n = top;
		top = s;
		s = 7 - n;
		break;
	case 'S':
		s = top;
		top = n;
		n = 7 - s;
		break;
	case 'E':
		e = top;
		top = w;
		w = 7 - e;
		break;
	case 'W':
		w = top;
		top = e;
		e = 7 - w;
		break;
	}
}

int Dice::getTop(){
	return top;
}

int main(void){
	int num[6];
	string str;
	Dice dice;

	for (int i = 0; i < 6; i++){
		cin >> num[i];
	}

	cin >> str;

	for (int i = 0; i < str.size(); i++){
		dice.roll(str[i]);
	}
	
	cout << num[dice.getTop()-1] << "\n";

	return 0;
}