infile = open("typing.in", "r")
outfile = open("typing.out", "w")
m, n, l = list(map(int, infile.readline().split()))
st = infile.readline().rstrip()
a = dict()
for i in range(n):
    coun, stl = infile.readline().rstrip().split()
    coun = int(coun)
    for i in range(len(stl)):
        if a.get(stl[:i], 1000000) > coun:
            a[stl[:i]] = coun
        if a.get(stl[i:], 10000000) > coun:
            a[stl[i:]] = coun
b = [100000000] * (m + 1)
b[0] = 0
for i in range(1, m + 1):
    for j in range(1, i + 1):
        b[i] = min(b[i], b[j - 1] + a.get(st[j - 1: i + 1], 100000000000))
if b[-1] > 10000000:
    outfile.write("-1")
else:
    outfile.write(str(b[-1]))