#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a, b, c, d, counter = 0;
  cin >> a >> b >> c >> d;
  string s;
  cin >> s;
  for (unsigned int i = 0; i < s.size(); i++) {
    if (s[i] == '1') {
      counter += a;
    } else if (s[i] == '2') {
      counter += b;
    } else if (s[i] == '3') {
      counter += c;
    } else {
      counter += d;
    }
  }
  cout << counter;
  return 0;
}
