#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
int main() {
  unsigned int arr[4];
  char str[100001];
  char *ptr;
  unsigned int result;
  scanf("%i%i%i%i", &arr[0], &arr[1], &arr[2], &arr[3]);
  scanf("%s", str);
  result = 0;
  for (ptr = str; *ptr != 0; ptr++) result += arr[*ptr - '1'];
  printf("%i", result);
  return 0;
}
