#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, temp, start, cal = 0, count = 0;
  int a[4], b[4];
  char s[100001];
  scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]);
  scanf("%s", s);
  memset(b, 0, sizeof b);
  for (i = 0; i < strlen(s); i++) {
    if (count == 4) break;
    temp = s[i] - '0';
    cal += a[temp - 1];
    if (!b[temp]) {
      b[temp] = 1;
      count++;
    }
  }
  printf("%d\n", cal);
  return 0;
}
