#include <bits/stdc++.h>
int gcd(int a, int b) { return ((b == 0) ? a : gcd(b, a % b)); }
int lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
bool SQR(long double n) {
  long double sq = sqrt(n);
  return ((sq - floor(sq)) == 0);
}
using namespace std;
string s;
int a, b, c, d;
class Task {
 public:
  void solve() {
    cin >> a >> b >> c >> d >> s;
    int sq1 = 0, sq2 = 0, sq3 = 0, sq4 = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '1') {
        sq1++;
      }
      if (s[i] == '2') {
        sq2++;
      }
      if (s[i] == '3') {
        sq3++;
      }
      if (s[i] == '4') {
        sq4++;
      }
    }
    int ans = (sq1 * a) + (sq2 * b) + (sq3 * c) + (sq4 * d);
    cout << ans;
  }
};
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  Task problem;
  problem.solve();
  return 0;
}
