#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[4];
  char c;
  int sum = 0;
  for (int i = 0; i < 4; i++) cin >> arr[i];
  while (cin >> c) {
    if (c == '1') sum += arr[0];
    if (c == '2') sum += arr[1];
    if (c == '3') sum += arr[2];
    if (c == '4') sum += arr[3];
  }
  cout << sum;
  return 0;
}
