#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[5];
  for (int i = 1; i <= 4; i++) {
    cin >> arr[i];
  }
  string s;
  cin >> s;
  int n = s.length();
  int calories = 0;
  for (int i = 0; i < n; i++) {
    calories += arr[int(s[i]) - 48];
  }
  cout << calories;
}
