#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string str;
  cin >> str;
  int arr[4] = {0};
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '1')
      arr[0]++;
    else if (str[i] == '2')
      arr[1]++;
    else if (str[i] == '3')
      arr[2]++;
    else
      arr[3]++;
  }
  cout << arr[0] * a + arr[1] * b + arr[2] * c + arr[3] * d;
}
