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