#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int a[5];
  a[0] = 0;
  for (long long int i = 1; i < 5; i++) cin >> a[i];
  string s;
  cin >> s;
  long long int i = 0, sum = 0;
  while (s[i] != '\0') {
    sum += a[s[i] - '0'];
    i++;
  }
  cout << sum;
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  long long int t = 1;
  while (t--) solve();
  return 0;
}
