#include <bits/stdc++.h>
int main() {
  int i, a[5], b[5], num = 0;
  char str[1000000];
  for (i = 1; i <= 4; i++) scanf("%d", &a[i]);
  memset(b, 0, sizeof(b));
  scanf("%s", str);
  int l = strlen(str);
  for (i = 0; i < l; i++) {
    b[str[i] - '0']++;
  }
  num = 0;
  for (i = 1; i <= 4; i++) num += a[i] * b[i];
  printf("%d\n", num);
  return 0;
}
