#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4], sum = 0, x;
  string s;
  for (int i = 0; i < 4; i++) cin >> a[i];
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    x = s[i] - 48;
    sum += a[x - 1];
  }
  cout << sum;
  return 0;
}
