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