import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D {
	static final long inf = (long) 1e16;

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader("typing.in"));
		StringTokenizer st = new StringTokenizer(in.readLine());
		int m = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());
		int L = Integer.parseInt(st.nextToken());
		String s = in.readLine();
		String[] words = new String[n];
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			st = new StringTokenizer(in.readLine());
			c[i] = Integer.parseInt(st.nextToken());
			words[i] = st.nextToken();
		}
		long[] dp = new long[m + 1];
		Arrays.fill(dp, inf);
		dp[0] = 0;
		for (int i = 0; i < dp.length; i++) {
			if (dp[i] >= inf)
				continue;
			for (int k = 0; k < n; k++) {
				String word = words[k];
				for (int j = 0; j < word.length(); j++) {
					String pref = word.substring(0, j);
					String suf = word.substring(j);
					if (s.startsWith(pref)) {
						dp[i + pref.length()] = Math.min(dp[i + pref.length()], dp[i] + c[k]);
					}
					if (s.startsWith(suf)) {
						dp[i + suf.length()] = Math.min(dp[i + suf.length()], dp[i] + c[k]);
					}
				}
			}
			if (s.length() != 0)
				s = s.substring(1);
		}
		// System.out.println(Arrays.toString(dp));
		PrintWriter out = new PrintWriter("typing.out");
		out.println(dp[m] < inf ? dp[m] : -1);
		out.close();
	}

}
