#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  int v, b, n, m, sum = 0;
  cin >> v >> b >> n >> m;
  cin >> a;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == '1') {
      sum = sum + v;
    } else if (a[i] == '2') {
      sum = sum + b;
    } else if (a[i] == '3') {
      sum = sum + n;
    } else if (a[i] == '4') {
      sum = sum + m;
    }
  }
  cout << sum << endl;
  return 0;
}
