#include <bits/stdc++.h>
using namespace std;
long long fix(long long cur, long long m) { return ((cur % m) + m) % m; }
long long fast_power(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long temp = fast_power(x, y / 2, m);
  temp = (temp * temp) % m;
  if (y % 2 != 0) temp = (temp * x) % m;
  return temp;
}
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  int arr[5];
  cin >> arr[1] >> arr[2] >> arr[3] >> arr[4];
  string str;
  cin >> str;
  int cnt = 0;
  for (int i = 0; i < str.size(); i++) cnt += arr[str[i] - '0'];
  cout << cnt << "\n";
  return 0;
}
