#include <bits/stdc++.h>
using namespace std;
char str[100010];
int main() {
  int a1, a2, a3, a4;
  scanf("%d%d%d%d", &a1, &a2, &a3, &a4);
  scanf("%s", str);
  int n = strlen(str);
  int an = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == '1') an += a1;
    if (str[i] == '2') an += a2;
    if (str[i] == '3') an += a3;
    if (str[i] == '4') an += a4;
  }
  printf("%d", an);
  return 0;
}
