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