#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, p, a1, a2, a3, a4, m = 0;
  char s[100001];
  cin >> a1 >> a2 >> a3 >> a4;
  cin >> s;
  for (i = 0; s[i]; i++) {
    if (s[i] == '4') m += a4;
    if (s[i] == '3') m += a3;
    if (s[i] == '2') m += a2;
    if (s[i] == '1') m += a1;
  }
  cout << m;
  return 0;
}
