#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, ans = 0;
  string s;
  cin >> a >> b >> c >> d;
  cin.get();
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '1')
      ans += a;
    else if (s[i] == '2')
      ans += b;
    else if (s[i] == '3')
      ans += c;
    else
      ans += d;
  }
  cout << ans << endl;
  return 0;
}
