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