#include <bits/stdc++.h>
int main() {
  long long int a1, a2, a3, a4, i, sum = 0;
  scanf("%I64d %I64d %I64d %I64d\n", &a1, &a2, &a3, &a4);
  char str[100010];
  gets(str);
  long long int a = strlen(str);
  for (i = 0; i < a; i++) {
    if (str[i] == '1')
      sum = sum + a1;
    else if (str[i] == '2')
      sum = sum + a2;
    else if (str[i] == '3')
      sum = sum + a3;
    else if (str[i] == '4')
      sum = sum + a4;
  }
  printf("%I64d", sum);
}
