#include <bits/stdc++.h>
int main() {
  int v[5], i, n;
  long long answ = 0;
  char a[100000];
  for (i = 1; i <= 4; ++i) scanf("%d", &v[i]);
  scanf("%s", &a);
  n = strlen(a);
  for (i = 0; i < n; ++i) answ = answ + v[a[i] - 48];
  printf("%I64d", answ);
}
