#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, i, sum = 0;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  string str;
  cin >> str;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == '1') sum += a;
    if (str[i] == '2') sum += b;
    if (str[i] == '3') sum += c;
    if (str[i] == '4') sum += d;
  }
  printf("%d", sum);
  return 0;
}
