#include <bits/stdc++.h>
int main() {
  int a1, b2, c3, d4, b, i;
  long long amt = 0;
  char mystr[100005] = {0}, r;
  scanf("%d %d %d %d", &a1, &b2, &c3, &d4);
  scanf("%s", mystr);
  b = strlen(mystr);
  b = b - 1;
  while (b >= 0) {
    if (mystr[b] == '1')
      amt += a1;
    else if (mystr[b] == '2')
      amt += b2;
    else if (mystr[b] == '3')
      amt += c3;
    else
      amt += d4;
    b--;
  }
  printf("%lld\n", amt);
  return 0;
}
