#include <bits/stdc++.h>
using namespace std;
char c[100004];
int a[14], ans = 0;
int main() {
  for (int i = 1; i <= 4; i++) cin >> a[i];
  cin >> c;
  int len = strlen(c);
  for (int i = 0; i < len; i++) {
    int p = c[i] - 48;
    ans += a[p];
  }
  cout << ans << endl;
  return 0;
}
