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