#include <bits/stdc++.h>
using namespace std;
const int MAX = 5e5 + 10, mod = 1e9 + 9, base = 41, INF = 1e9 + 10, sq = 502;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long a, b, c, d, ans = 0;
  cin >> a >> b >> c >> d;
  string s;
  cin >> s;
  for (long long i = 0; i < (s.size()); ++i) {
    if (s[i] == '1')
      ans += a;
    else if (s[i] == '2')
      ans += b;
    else if (s[i] == '3')
      ans += c;
    else if (s[i] == '4')
      ans += d;
  }
  cout << ans << endl;
  return 0;
}
