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

public class D0 {
	String fileName = "typing";
	
	long N = 1000000009;
	long M = 1000000007;
	long[] pow;
	
	long get(int x, int y, long[] h) {
		if (x == 0) {
			return h[y];
		}
		return h[y] - h[x - 1] * pow[y - x + 1];
	}
	
	public void solve() throws IOException {
    	int n = nextInt(), m = nextInt(), l = nextInt();
    	String sin = nextToken();
    	int sinl = sin.length();
    	int[] s = new int[sinl];
    	long[] hs = new long[2 * l];
     	for (int i = 0; i < sinl; i++) {
			s[i] = sin.charAt(i) - '0';
		}
     	hs[0] = s[0];
     	for (int i = 1; i < sinl; i++) {
			hs[i] = (hs[i - 1] * N + s[i]) % M;
		}
    	pow = new long[2 * l];
    	pow[0] = 1;
    	for (int i = 1; i < pow.length; i++) {
			pow[i] = (pow[i - 1] * N) % M;
		}
    	
    	
    	int[][] a = new int[m][];
    	long[][] ha = new long[m][];
    	int[] c = new int[m];
    	for (int zzz = 0; zzz < m; zzz++) {
			c[zzz] = nextInt();
			String cin = nextToken();
			int cinl = cin.length();
			a[zzz] = new int[cinl];
			for (int ttt = 0; ttt < cinl; ttt++) {
				a[zzz][ttt] = cin.charAt(ttt) - '0';
			}
			ha[zzz] = new long[cinl];
			ha[zzz][0] = a[zzz][0];
			for (int i = 1; i < ha[zzz].length; i++) {
				ha[zzz][i] = (ha[zzz][i - 1] * N + a[zzz][i]) % M;
			}
		}
    	
    	
    	int[] dp = new int[2 * l];
    	Arrays.fill(dp, Integer.MAX_VALUE);
    	dp[0] = 0;
    	for (int i = 0; i < sinl; i++) {
			for (int z = 0; z < m; z++) {
				for (int x = 0; x < a[z].length; x++) {
					if (get(0, x, ha[z]) == get(i, i + x, hs)) {
						if (dp[i] + c[z] < dp[i + x + 1]) {
							dp[i + x + 1] = dp[i] + c[z];
						}
					}
				}
				for (int x = 0; x < a[z].length; x++) {	
					if (get(x, a[z].length - 1, ha[z]) == get(i, i + x, hs)) {
						if (dp[i] + c[z] < dp[i + (a[z].length - x)]) {
							dp[i + (a[z].length - x)] = dp[i] + c[z];
						}
					}
				}
			}
		}
    	
    
    	out.println((dp[sinl] == Integer.MAX_VALUE) ? -1 : dp[sinl]);
	}

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

}