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