#include <bits/stdc++.h>
using namespace std;
long long int my_gcd(long long int n, long long int m) {
  if (n % m == 0) return m;
  if (n < m) swap(n, m);
  while (m > 0) {
    n = n % m;
    swap(n, m);
  }
  return n;
}
void solve(int x11) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string s;
  cin >> s;
  vector<int> v(5, 0);
  for (long long i = 0; i < s.length(); i++) {
    int d = s[i];
    d -= 48;
    v[d] += 1;
  }
  long long int sum = a * v[1] + b * v[2] + c * v[3] + d * v[4];
  cout << sum;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (long long i = 0; i < t; i++) {
    solve(i);
  }
}
