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