#!/usr/bin/python3
unused, stitch, startend = [int(x) for x in input().split()]
w = input()
p = input()

for color in w:
    cnt = p.count(color)
    if cnt == 0:
        print(0)
    else:
        first = p.find(color)
        last = p.rfind(color)
        print(2 * startend + cnt * stitch + (last + 1 - first - cnt) * unused)
