#include <bits/stdc++.h>
using namespace std;
int a[5], sum = 0;
int main() {
  string s;
  for (int i = 1; i <= 4; i++) cin >> a[i];
  cin >> s;
  for (int i = 0; i < s.size(); i++) sum += a[s[i] - '0'];
  cout << sum << endl;
}
