#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, sum = 0;
  string str;
  vector<int> kal(4);
  for (i = 0; i < 4; i++) cin >> kal[i];
  cin >> str;
  for (i = 0; i < str.length(); i++) sum += kal[str[i] - '1'];
  cout << sum;
  getchar();
  getchar();
  return 0;
}
