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