#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int coun = 0, a1, a2, a3, a4;
  cin >> a1 >> a2 >> a3 >> a4;
  cin >> str;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '1')
      coun += a1;
    else if (str[i] == '2')
      coun += a2;
    else if (str[i] == '3')
      coun += a3;
    else
      coun += a4;
  }
  cout << coun << endl;
  return 0;
}
