# your code goes here
def calculate_tax(S, X, Y):
tax = 0
index = 0
while index < len(S):
if S[index:index+2] == "10":
tax += Y
elif S[index:index+2] == "01":
tax += X
index += 1
return tax
X = int(input())
Y = int(input())
S = input()
print(calculate_tax(S,X,Y))
X = int(input())
Y = int(input())
S = input()
print(calculate_tax(S,X,Y))
X = int(input())
Y = int(input())
S = input()
print(calculate_tax(S,X,Y))
X = int(input())
Y = int(input())
S = input()
print(calculate_tax(S,X,Y))
X = int(input())
Y = int(input())
S = input()
print(calculate_tax(S,X,Y))
IyB5b3VyIGNvZGUgZ29lcyBoZXJlCgpkZWYgY2FsY3VsYXRlX3RheChTLCBYLCBZKToKCXRheCA9IDAKCWluZGV4ID0gMAoJd2hpbGUgaW5kZXggPCBsZW4oUyk6CgkJaWYgU1tpbmRleDppbmRleCsyXSA9PSAiMTAiOgoJCQl0YXggKz0gWQoJCWVsaWYgU1tpbmRleDppbmRleCsyXSA9PSAiMDEiOgoJCQl0YXggKz0gWAoJCWluZGV4ICs9IDEKCXJldHVybiB0YXgKCQoJCgkKCQpYID0gaW50KGlucHV0KCkpClkgPSBpbnQoaW5wdXQoKSkKUyA9IGlucHV0KCkKcHJpbnQoY2FsY3VsYXRlX3RheChTLFgsWSkpCgpYID0gaW50KGlucHV0KCkpClkgPSBpbnQoaW5wdXQoKSkKUyA9IGlucHV0KCkKcHJpbnQoY2FsY3VsYXRlX3RheChTLFgsWSkpCgpYID0gaW50KGlucHV0KCkpClkgPSBpbnQoaW5wdXQoKSkKUyA9IGlucHV0KCkKcHJpbnQoY2FsY3VsYXRlX3RheChTLFgsWSkpCgpYID0gaW50KGlucHV0KCkpClkgPSBpbnQoaW5wdXQoKSkKUyA9IGlucHV0KCkKcHJpbnQoY2FsY3VsYXRlX3RheChTLFgsWSkpCgpYID0gaW50KGlucHV0KCkpClkgPSBpbnQoaW5wdXQoKSkKUyA9IGlucHV0KCkKcHJpbnQoY2FsY3VsYXRlX3RheChTLFgsWSkp