import java.io.*;
import java.util.*;

public class d3 {

	static long mod = (int) (1e9 + 7);
	static long p = 239;

	static long power[];
	static long h[];

	static long geth(int l, int r) {
		if (l == 0) {
			return h[r];
		} else {
			return (mod + h[r] - (power[r - l + 1] * h[l - 1]) % mod) % mod;
		}
	}

	public static void main(String args[]) throws FileNotFoundException {
		Scanner in = new Scanner(new File("typing.in"));
		PrintWriter out = new PrintWriter("typing.out");

		int m = in.nextInt();
		int n = in.nextInt();
		int l = in.nextInt();

		h = new long[m];
		power = new long[m + 1];

		String s = in.next();

		long dp[] = new long[m + 1];

		long c[] = new long[n];
		String st[] = new String[n];

		long last = 0;
		long pr = 1;

		power[0] = 1;

		for (int i = 0; i < m; i++) {
			h[i] = (1l * last * p + s.charAt(i)) % mod;
			power[i + 1] = (1l * pr * p) % mod;

			last = h[i];
			pr = power[i + 1];
		}

		for (int i = 0; i < n; i++) {

			c[i] = in.nextInt();
			st[i] = in.next();
		}

		Arrays.fill(dp, Long.MAX_VALUE);
		dp[0] = 0;

		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (dp[i] != Long.MAX_VALUE) {
					int l1 = i;
					int l2 = 0;

					while (l1 < m && l2 < st[j].length() && s.charAt(l1) == st[j].charAt(l2)) {
						l1++;
						l2++;

						dp[l1] = Math.min(dp[l1], dp[i] + c[j]);
					}

					l1 = i;
					l2 = st[j].length() - 1;

					long hash = st[j].charAt(l2);

					for (l2 = st[j].length() - 1; l2 > -1 && l1 < m; l2--) {
						if (hash == geth(i, l1)) {
							dp[l1] = Math.min(dp[l1], dp[i] + c[j]);
						}

						l1++;

						if (l2 > 0) {
							hash += 1l * st[j].charAt(l2 - 1) * power[st[j].length() - l2];
							hash %= mod;
						}
					}
				}
			}
		}

		if (dp[m] == Long.MAX_VALUE) {
			out.println(-1);
		} else {
			out.println(dp[m]);
		}

		out.close();
	}

}