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