#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum = 0;
  int a[4];
  for (int u = 0; u < 4; u++) {
    cin >> a[u];
  }
  string s;
  cin >> s;
  int c = 0;
  while (c < s.size()) {
    if (s[c] == '1')
      sum += a[0];
    else if (s[c] == '2')
      sum += a[1];
    else if (s[c] == '3')
      sum += a[2];
    else if (s[c] == '4')
      sum += a[3];
    c++;
  }
  cout << sum;
  return 0;
}
