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