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

/**
 * Created by roi on 07.04.2016.
 */
public class Task8 {

    void solve(IOReader io) {
        m = io.nextInt();
        n = io.nextInt();
        l = io.nextInt();
        s = io.readLine();
        cost = new int[n];
        word = new String[n];
        for (int i = 0; i < n; i++) {
            cost[i] = io.nextInt();
            word[i] = io.nextToken();
        }

        kek = new int[s.length()];
        int ans = go(0);
        io.println(ans >= INF ? -1 : ans);
    }

    int n, m, l;
    String s;
    int[] cost;
    String[] word;

    int[] kek;

    int go(int i) {
        if (i == m) return 0;
        if (kek[i] != 0) return kek[i];

        int res = INF;
        for (int j = 0; j < n; j++) {
            int minCost = INF;
            for (int pref = 1; pref <= word[j].length() && i + pref <= m; pref++) {
                if (s.substring(i, i + pref).equals(word[j].substring(0, pref))) {
//                    System.err.println(s.substring(i, i + pref));
                    int cur = go(i + pref);
                    if (cur < minCost) {
                        minCost = cur;
                    }
                } else break;
            }
            for (int suf = 1; suf <= word[j].length() && i + suf <= m; suf++) {
                if (s.substring(i, i + suf).equals(word[j].substring(word[j].length() - suf, word[j].length()))) {
//                    System.err.println(s.substring(i, i + suf));
                    int cur = go(i + suf);
                    if (cur < minCost) {
                        minCost = cur;
                    }
                } else break;
            }
            minCost += cost[j];

            if (minCost < res) {
                res = minCost;
            }
        }
//        System.err.println("--- " + res);
        return res;
    }

    final int INF = Integer.MAX_VALUE / 2;


    public static void main(String[] args) {
        Task8 solver = new Task8();
        IOReader io = new IOReader("typing");
        solver.solve(io);
        io.out.close();
    }

    static class IOReader {
        BufferedReader in;
        StringTokenizer tok;
        PrintWriter out;

        IOReader(String file) {
            try {
                in = new BufferedReader(new FileReader(file + ".in"));
                out = new PrintWriter(file + ".out");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String nextToken() {
            if (tok == null || !tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }
            return tok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        String readLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }

        void println(long x) {
            out.println(x);
        }
    }

}
