#include <bits/stdc++.h>
int main() {
  int a1, a2, a3, a4;
  std::cin >> a1 >> a2 >> a3 >> a4;
  std::string s;
  std::cin >> s;
  long long calories = 0LL;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '1')
      calories += (long long)a1;
    else if (s[i] == '2')
      calories += (long long)a2;
    else if (s[i] == '3')
      calories += (long long)a3;
    else
      calories += (long long)a4;
  }
  std::cout << calories << "\n";
  return 0;
}
