#include <bits/stdc++.h>
using namespace std;
char s[100005];
int main(void) {
  int a[4], f = 0;
  for (int i = 0; i < 4; i++) scanf("%d", &a[i]);
  scanf("%s", s);
  for (int i = 0; s[i]; i++) f += a[s[i] - '1'];
  printf("%d\n", f);
  return 0;
}
