#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, i, cb = 0;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  char A[100000];
  for (i = 0; i < 100000; i++) {
    cin >> A[i];
    if (A[i] == '\0')
      break;
    else if (A[i] == '1')
      cb = cb + a;
    else if (A[i] == '2')
      cb = cb + b;
    else if (A[i] == '3')
      cb = cb + c;
    else if (A[i] == '4')
      cb = cb + d;
  }
  cout << cb;
  return 0;
}
