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

public class d2 {
	public void solve() throws IOException {
		int m = nextInt();
		int n = nextInt();
		int l = nextInt();

		String s = nextToken();

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

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

		for (int i = 0; i < n; i++) {
			c[i] = nextInt();
			st[i] = nextToken();
		}

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

		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < st[j].length(); k++) {
					if (dp[i] != Long.MAX_VALUE && i + k < m && s.charAt(i + k) == st[j].charAt(k)) {
						dp[i + k + 1] = Math.min(dp[i + k + 1], dp[i] + c[j]);
					}
					else{
						break;
					}
				}

				int ct = 0;
				for (int k = st[j].length() - 1; k > -1; k--) {
					if (dp[i] != Long.MAX_VALUE && i + ct < m && s.charAt(i + ct) == st[j].charAt(k)) {
						dp[i + ct] = Math.min(dp[i + ct], dp[i] + c[j]);
						ct++;
					}
					else{
						break;
					}
				}
			}
		}

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

	}

	public void run() {
		try {
			br = new BufferedReader(new FileReader("typing.in"));
			out = new PrintWriter("typing.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	static BufferedReader br;
	static StringTokenizer in;
	PrintWriter out;

	public static String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		new d2().run();
	}

}