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

public class TypingStable {
    private String fileName = "typing";

    public void solve() throws IOException {
        int m = nextInt(), n = nextInt(), l = nextInt();
        String str = nextToken();
        int base = 10000009;
        int[][] hash = new int[m][m];
        for (int i = 0; i < m; i++) {
            hash[i][i] = (str.charAt(i) - '0' + 1);
        }
        for (int i = 1; i < m; i++) {
            for (int j = 0; j < i; j++) {
                hash[j][i] = (hash[j][i - 1] * 3 + (str.charAt(i) - '0' + 1)) % base;
            }
        }

        long[] deg3 = new long[l + 1];
        deg3[0] = 1;
        for (int i = 1; i <= l; i++) {
            deg3[i] = (deg3[i - 1] * 3) % base;
        }
        HashMap<Integer, Integer> sub = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int c = nextInt();
            String s = nextToken();
            int h = 0;
            for (int t = 0; t < s.length(); t++) {
                h = (h * 3 + (s.charAt(t) - '0' + 1)) % base;
                if (sub.containsKey(h)) {
                    sub.put(h, Math.min(sub.get(h), c));
                } else {
                    sub.put(h, c);
                }
            }
            for (int t = 0; t < s.length() - 1; t++) {
                h = (int) ((h - ((s.charAt(t) - '0' + 1) * deg3[s.length() - t - 1]) + base) % base);
                if (sub.containsKey(h)) {
                    sub.put(h, Math.min(sub.get(h), c));
                } else {
                    sub.put(h, c);
                }
            }
        }

        int[] res = new int[m + 1];
        Arrays.fill(res, Integer.MAX_VALUE);
        res[0] = 0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j <= i; j++) {
                if (sub.containsKey(hash[j][i])) {
                    res[i + 1] = Math.min(res[i + 1], res[j] + sub.get(hash[j][i]));
                }
            }
        }

        out.println(res[m] == Integer.MAX_VALUE ? -1 : res[m]);
    }

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

}