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