#include <bits/stdc++.h>
using namespace std;
int main() {
  int ch[4], c, sum = 0;
  for (int i = 0; i < 4; i++) {
    cin >> ch[i];
  }
  string s;
  cin >> s;
  int b = s.size();
  for (int i = 0; i < b; i++) {
    sum += ch[(s[i] - '0') - 1];
  }
  cout << sum;
  return 0;
}
