#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define repit(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define all(v) (v).begin(), (v).end()
#define copyy(it, v) copy(all(it), v.begin())
#define sortt(v) sort(all(v))
#define sortr(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define vd vector<double>
#define vvd vector<vd>
#define vvvd vector<vvd>
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define mkp make_pair
#define mkt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
// inline void fastio() { ios::sync_with_stdio(false), cin.tie(0); }
/******* Variable ************************************/
const int maxn = 1e6 * 50;
const int inf = 1e9 + 7;
const double pi = 3.141592653589;
/******* Function ************************************/
vi solve(vi a, char s) {
  vi tmp = a;
  if (s == 'E') {
    tmp[1] = a[4], tmp[3] = a[1], tmp[4] = a[6], tmp[6] = a[3];
  }
  if (s == 'N') {
    tmp[1] = a[2], tmp[2] = a[6], tmp[5] = a[1], tmp[6] = a[5];
  }
  if (s == 'S') {
    tmp[1] = a[5], tmp[2] = a[1], tmp[5] = a[6], tmp[6] = a[2];
  }
  if (s == 'W') {
    tmp[1] = a[3], tmp[3] = a[6], tmp[4] = a[1], tmp[6] = a[4];
  }
  copyy(tmp, a);
  return a;
}
/******* Main ****************************************/
void Main() {
  vi a(7);

  rep(i, 1, 7) {
    cin >> a[i];
  }
  string s;
  cin >> s;
  rep(i, 0, s.size()) {
    a = solve(a, s[i]);
  }
  cout << a[1]<<'\n';
}
/******************************************************
  Smaile!
▕▔╲┊┊┊┊┊┊┊┊┊╱▔▏
┊╲┈╲╱▔▔▔▔▔╲╱┈╱┊
┊┊╲┈╭╮┈┈┈╭╮┈╱┊┊
┊┊╱┈╰╯┈▂┈╰╯┈╲┊┊
┊┊▏╭╮▕━┻━▏╭╮▕┊┊
┊┊╲╰╯┈╲▂╱┈╰╯╱
                    How`s it going?
                            |＼
                    　／￣＼　ヽ
                    ／　　　ヽ |_
                    ￣＼　　　　 ＼
                    ／￣　/|/| /ﾚ､ ヽ＿
                    ￣＼ Yヘ |/ヘ幺　∠
                    　＜_|(･> <･) 6) ／
                      　　 (ﾞ　_　ﾞ／＜
                      　　　＞､ーイ￣￣
                    　　／厂ヽ／￣/＼
                    　 ( ｜　(亀)(>　)▏

                            Take a rest before getting tired!
                                        　　 ●
                                        　　/⌒ヽ
                                        　 ｜ 　|/⌒ヽ(ヽ
                                        　 (｀　∥ー⌒) |
                                        　|￣||￣￣￣￣￣|
                                        　|―||―――――|
                                        　|　Ｕ　　　　　|
                                        　|￣￣￣￣￣￣￣|
                                        　|＿＿＿＿＿＿＿|
                                        　　|―――――|
                                        　　|―――――|
                                        ｗｗＷｗｗＷｗＷＷｗ

******************************************************/
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 3216