#include <bits/stdc++.h>
using namespace std;
int main() {
  int c1, c2, c3, c4;
  char sl[100000] = {0};
  cin >> c1 >> c2 >> c3 >> c4;
  cin >> sl;
  int sum = 0;
  for (int i = 0; sl[i] != 0; i++) {
    switch (sl[i]) {
      case '1':
        sum += (c1);
        break;
      case '2':
        sum += (c2);
        break;
      case '3':
        sum += (c3);
        break;
      case '4':
        sum += (c4);
        break;
    }
  }
  cout << sum;
  return 0;
}
