#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
    int n,m;
    string S;
    int dice[6];
    for(int i=0;i<6;i++){
        cin>>dice[i];
    }
    cin>>S;
    for(int i=0;i<S.size();i++){
        if(S[i]=='N'){
            m=dice[0];
            dice[0]=dice[1];
            dice[1]=dice[5];
            dice[5]=dice[4];
            dice[4]=m;
        }
        else if(S[i]=='S'){
            m=dice[0];
            dice[0]=dice[4];
            dice[4]=dice[5];
            dice[5]=dice[1];
            dice[1]=m;
        }
        else if(S[i]=='W'){
            m=dice[0];
            dice[0]=dice[2];
            dice[2]=dice[5];
            dice[5]=dice[3];
            dice[3]=m;
        }
        else if(S[i]=='E'){
            m=dice[0];
            dice[0]=dice[3];
            dice[3]=dice[5];
            dice[5]=dice[2];
            dice[2]=m;
        }
        m=0;
    }
    cout<<dice[0]<<endl;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b

signed main(){
	int n; cin>>n;
	string a,b,c; cin>>a>>b>>c;
	int ans=0;
	rep(i,0,n){
		if(a[i]!=b[i] && b[i]!=c[i] && a[i]!=c[i])ans+=2;
		else if(a[i]==b[i] && b[i]==c[i] && a[i]==c[i])ans=ans;
		else ans++;
	}
	cout<<ans<<endl;
	return 0;
}