#include <bits/stdc++.h>
using namespace std;
const int Mxn = 1e4;
string s[Mxn];
string check = "EWSN";
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, -1, 1};
int n, m;
int stringDiscover(string s) {
  map<array<int, 2>, map<array<int, 2>, bool>> mp;
  int res = 0;
  int x = 0, y = 0;
  for (int i = 0; s[i]; i++) {
    for (int j = 0; j < 4; j++) {
      if (check[j] == s[i] && !mp[{x, y}][{x + dx[j], y + dy[j]}]) {
        mp[{x, y}][{x + dx[j], y + dy[j]}] = true;
        mp[{x + dx[j], y + dy[j]}][{x, y}] = true;
        res += 3;
        x = x + dx[j], y = y + dy[j];
        break;
      } else if (check[j] == s[i]) {
        res += 1;
        x = x + dx[j], y = y + dy[j];
        break;
      }
    }
  }
  return res;
}
int main() {
  int a[4];
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  string s;
  cin >> s;
  int res = 0;
  for (int i = 0; s[i]; i++) {
    res += a[s[i] - '1'];
  }
  cout << res << endl;
  return 0;
}
