#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x, count = 0, w, digit;
  string y;
  vector<int> v;
label:
  for (int i = 0; i < 4; i++) {
    cin >> x;
    v.push_back(x);
  }
  cin >> y;
  for (int i = 0; i < y.length(); i++) {
    int ia = y[i];
    w = ia - 48;
    count += v[w - 1];
  }
  cout << count << endl;
  return 0;
}
