#include <iostream>
#include <vector>
#include <map>
#include <climits>


using namespace std;

int main() {
    int n, m, l, lmax = 0;
    string s;
    cin >> n >> m >> l >> s;
    map<string, int> c;
    int cc;
    string cs;
    for (int mi = 0; mi < m; ++mi) {
        cin >> cc >> cs;
        lmax = max(lmax, (int) cs.length());
        for (int i = 1; i <= (int) cs.length(); ++i) {
            string ss = cs.substr(0, i);
            if (c.count(ss)) {
                c[ss] = min(c[ss], cc);
            } else {
                c[ss] = cc;
            }
        }
        for (int i = 0; i < (int) cs.length(); ++i) {
            string ss = cs.substr(i);
            if (c.count(ss)) {
                c[ss] = min(c[ss], cc);
            } else {
                c[ss] = cc;
            }
        }
    }
    vector<long long int> d(n + 1);
    for (int i = 1; i <= n; ++i) {
        d[i] = LLONG_MAX / 4;
        for (int j = max(0, i - lmax - 1); j < i; ++j) {
            string ss = s.substr(j, i - j);
            if (c.count(ss)) {
                d[i] = min(d[i], c[ss] + d[j]);
            }
        }
    }
    cout << (d[n] == LLONG_MAX / 4 ? -1 : d[n]) << endl;

    return 0;
}
