#include <bits/stdc++.h>
using namespace std;
int ar[100001];
int main() {
  vector<int> v;
  int ite, t;
  ite = 4;
  for (int i = 0; i < (ite); i++) {
    cin >> t;
    v.push_back(t);
  }
  long long res = 0;
  string s;
  cin >> s;
  for (int i = 0; i < (s.length()); i++) {
    res += v[s[i] - '0' - 1];
  }
  cout << res << endl;
  return 0;
}
