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