#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> ii;
  char s[100001], g[100001];
  int a[4];
  for (int i = 1; i <= 4; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= 4; i++) ii[i] = a[i];
  scanf("%s", s);
  int sum = 0;
  for (int i = 0; i < strlen(s); i++) {
    sum += ii[s[i] - '0'];
  }
  cout << sum << endl;
  return 0;
}
