#include <bits/stdc++.h>
using namespace std;
int main() {
  int a1, a2, a3, a4, i, j, len, n, sum;
  string s;
  cin >> a1 >> a2 >> a3 >> a4;
  int ara[5];
  ara[1] = a1;
  ara[2] = a2;
  ara[3] = a3;
  ara[4] = a4;
  sum = 0;
  cin >> s;
  len = s.length();
  for (i = 0; i < len; i++) {
    n = s[i] - '0';
    sum = sum + ara[n];
  }
  cout << sum << endl;
}
