#include <bits/stdc++.h>
char st1 = '1', st2 = '2', st3 = '3', st4 = '4', str[100008];
int cal1, cal2, cal3, cal4;
unsigned long long sum;
int main() {
  scanf("%d %d %d %d %s", &cal1, &cal2, &cal3, &cal4, str);
  for (int i = 0; str[i]; i++) {
    if (str[i] == st1)
      sum += cal1;
    else if (str[i] == st2)
      sum += cal2;
    else if (str[i] == st3)
      sum += cal3;
    else if (str[i] == st4)
      sum += cal4;
  }
  printf("%lld", sum);
}
