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

public class d3 {
	public static void main(String args[]) throws FileNotFoundException {
		Scanner in = new Scanner(new File("typing.in"));
		PrintWriter out = new PrintWriter("typeing.out");
		
		int m = in.nextInt();
		int n = in.nextInt();
		int l = in.nextInt();

		String s = in.next();

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

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

		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;

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

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

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

		out.close();
	}

}