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