cal = list(map(int, input().split()))
strn = input()
sum_list = []
for i in strn:
if(i == "1"):
sum_list.append(cal[0])
elif(i == "2"):
sum_list.append(cal[1])
elif(i == "3"):
sum_list.append(cal[2])
elif(i == "4"):
sum_list.append(cal[3])
print(sum(sum_list))
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define For(i, s, e) for (ll i = s; i < e; i++)
#define FoR(i, s, e) for (ll i = s; i <= e; i++)
#define deFoR(i, s, e) for (ll i = s; i >= e; i--)
#define pb push_back
#define vii vector<ll>
#define makep make_pair
#define vpll vector<pair<ll, ll>>
#define fi first
#define se second
#define sii set<ll>
#define pii pair<int, int>
#define rev(c) reverse(c.begin(), c.end())
#define sortf(c) sort(c.begin(), c.end())
#define test() \
int test; \
cin >> test; \
while (test--)
#define fast() \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define sqr(n) (n)*(n)
#define len(s) (s.length())
ll const max2d = 1e4 + 7;
ll const N = 1e6 + 7;
ll const inf = 1e9 + 7;
char const nl = '\n';
// ! ¸,ø¤º°`°º¤ø,¸¸,ø¤º° [ нvмegy ] °º¤ø,¸¸,ø¤º°`°º¤ø,¸ roadтoнυe
void solve() {
}
signed main()
{
fast();
int a[5];
FoR(i, 1, 4) {
cin >> a[i];
}
string s;
cin >> s;
int sum = 0;
FoR(i, 0, len(s)-1) {
sum += a[s[i]-48];
}
cout << sum;
return 0;
}
71. Simplify Path | 62. Unique Paths |
50. Pow(x, n) | 43. Multiply Strings |
34. Find First and Last Position of Element in Sorted Array | 33. Search in Rotated Sorted Array |
17. Letter Combinations of a Phone Number | 5. Longest Palindromic Substring |
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |
1092. Shortest Common Supersequence | 1044. Longest Duplicate Substring |
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |