#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **args) {
  string s;
  int a1, a2, a3, a4, sum;
  cin >> a1 >> a2 >> a3 >> a4;
  cin >> s;
  sum = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '1')
      sum += a1;
    else if (s[i] == '2')
      sum += a2;
    else if (s[i] == '3')
      sum += a3;
    else if (s[i] == '4')
      sum += a4;
  }
  cout << sum << endl;
  return 0;
}
