#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> calories(4);
  for (int i = 0; i < calories.size(); i++) {
    cin >> calories[i];
  }
  int burnt = 0;
  string game;
  cin >> game;
  for (int i = 0; i < game.size(); i++) {
    burnt += calories[int(game[i] - 49)];
  }
  cout << burnt;
  return 0;
}
