#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  char s[(100010)];
  int a[4], b[4] = {0, 0, 0, 0};
  int i, out;
  for (i = 0; i < 4; ++i) scanf("%d", &a[i]);
  scanf("%s", s);
  for (i = 0; s[i] != '\0'; ++i) b[s[i] - '1']++;
  for (out = 0, i = 0; i < 4; ++i) out += a[i] * b[i];
  printf("%d\n", out);
  return 0;
}
