#include <bits/stdc++.h>
using namespace std;
int main() {
  int t[4];
  cin >> t[0] >> t[1] >> t[2] >> t[3];
  string s;
  cin >> s;
  int r = 0;
  for (int i = 0; i < s.length(); i++) r += t[s[i] - '1'];
  cout << r;
}
