#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4], res = 0;
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) res += a[(s[i] - '0') - 1];
  cout << res << "\n";
  return 0;
}
