#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t a[4], sum(0);
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  char c;
  do {
    cin >> c;
    sum += a[c - 49];
  } while (cin.good());
  sum -= a[c - 49];
  cout << sum;
  return 0;
}
