#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, count;
  cin >> a >> b >> c >> d;
  string str;
  cin >> str;
  long long len = str.length();
  count = 0;
  for (long long i = 0; i < len; i++) {
    if (str[i] == '1')
      count += a;
    else if (str[i] == '2')
      count += b;
    else if (str[i] == '3')
      count += c;
    else
      count += d;
  }
  cout << count << endl;
  return 0;
}
