#include <bits/stdc++.h>
int main() {
  int a[4];
  for (int i = 0; i < 4; ++i) std::cin >> a[i];
  int count = 0;
  std::string str;
  std::cin >> str;
  int x = str.size();
  for (int i = 0; i < x; ++i) {
    int s = str[i];
    if (s == 49)
      s = 1;
    else if (s == 50)
      s = 2;
    else if (s == 51)
      s = 3;
    else if (s == 52)
      s = 4;
    count += a[s - 1];
  }
  std::cout << count;
}
