#include <bits/stdc++.h>
using namespace std;
int main() {
  int cal[4];
  string state;
  for (int i = 0; i < 4; i++) {
    cin >> cal[i];
  }
  cin >> state;
  int n = state.size();
  int calcount = 0;
  for (int i = 0; i < n; i++) {
    calcount += cal[state[i] - '1'];
  }
  cout << calcount;
}
