#!/usr/bin/python3
(a, b, c), ws, ps = map(int, input().split()), input(), input()

for w in ws:
    strand, use = 0, c  # Using sneaky trick: [<b>, <a>][<cond>] instead of `<a> if <cond> else <b>`
    for p in ps: strand, use = [min(strand, use + c), use + b + c][p == w], min(strand + c, use) + [a, b][p == w]
    print(min(strand, use + c))
