#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum = 0, n = 0;
  long int x, y, z, g;
  string s;
  cin >> x >> y >> z >> g;
  cin >> s;
  n = s.length();
  for (int i = 0; i < n; i++) {
    if (s[i] == '1')
      sum = sum + x;
    else if (s[i] == '2')
      sum = sum + y;
    else if (s[i] == '3')
      sum = sum + z;
    else if (s[i] == '4')
      sum = sum + g;
  }
  cout << sum;
  return 0;
}
