#include <bits/stdc++.h>
using namespace std;
char s[100005];
int main() {
  int a[4];
  for (int i = 0; i < 4; i++) {
    cin >> a[i];
  }
  cin >> s;
  int l = strlen(s), sum = 0;
  for (int i = 0; i < l; i++) {
    sum = sum + a[s[i] - '0' - 1];
  }
  cout << sum << endl;
  return 0;
}
