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