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

public class main {
	String fileName = "typing";

	boolean con(int i, int j, int k) {
		if (s[k].length < j - i + 1)
			return false;
		boolean f = true;
		for (int x = 0; x < (j - i + 1); x++) {
			if (a[i + x] != s[k][x]) {
				f = false;
				break;
			}
		}
		if (f)
			return f;
		f = true;
		for (int x = 0; x < (j - i + 1); x++) {
			if (a[i + x] != s[k][s[k].length - (j - i + 1) + x]) {
				f = false;
				break;
			}

		}
		if (f)
			return f;
		else
			return false;
	}

	char[][] s;
	char[] a;

	public void solve() throws IOException {
		int m = nextInt();
		int n = nextInt();
		int L = nextInt();
		a = br.readLine().toCharArray();
		s = new char[n][];
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			c[i] = nextInt();
			s[i] = nextToken().toCharArray();
		}
		long[] dp = new long[a.length];
		for (int i = 0; i < a.length; i++) {
			dp[i] = 10000000;
			if (i == 0) {
				for (int j = 0; j < n; j++) {
					if (c[j] > dp[i])
						continue;
					if (c[j] < dp[i] && (s[j][0] == a[0] || s[j][s[j].length - 1] == a[0]))
						dp[i] = c[j];
				}
			} else {
				for (int k = 0; k < n; k++){
					if (con(0, i, k)){
						dp[i] = Math.min(dp[i], c[k]);
					}
				}
				for (int j = 1; j < i; j++) {
					for (int k = 0; k < n; k++) {
						if (dp[j - 1] + c[k] < dp[i] && (con(j, i, k))) {
							dp[i] = dp[j - 1] + c[k];
						}
					}
				}
			}
		}
		if (dp[m - 1] != 10000000)
			out.println(dp[m - 1]);
		else
			out.print(-1);
	}

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

			solve();

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

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

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

	public 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 main().run();
	}

}