#include <bits/stdc++.h>
int main() {
  int a1, a2, a3, a4, i = 0, sol = 0;
  scanf("%d %d %d %d", &a1, &a2, &a3, &a4);
  char s[100000];
  scanf("%s", &s);
  while (s[i] != '\0') {
    if (s[i] == '1') sol += a1;
    if (s[i] == '2') sol += a2;
    if (s[i] == '3') sol += a3;
    if (s[i] == '4') sol += a4;
    i++;
  }
  printf("%d", sol);
}
