#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4], n = 0;
  string b;
  for (int i = 0; i < 4; i++) {
    cin >> a[i];
  }
  cin >> b;
  for (int i = 0; i < b.length(); i++) {
    switch (b.at(i)) {
      case '1':
        n += a[0];
        break;
      case '2':
        n += a[1];
        break;
      case '3':
        n += a[2];
        break;
      case '4':
        n += a[3];
        break;
    }
  }
  cout << n;
  return 0;
}
