#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

using namespace std;

map<string, int> g;

string q, w, r;

long long d[100000];

int main() {
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    int n, m, k;
    cin >> n >> m >> k;
    cin >> w;
    for (int i = 0; i <= n; i++) {
        d[i] = (long long)1e18;
    }
    d[0] = 0;
    for (int i = 0; i < m; i++) {
        int c = 0;
        cin >> c;
        cin >> q;
        k = q.size();
        for (int j = 0; j < k; j++) {
            r = "";
            for (int l = j; l < k; l++) {
                r += q[l];
            }
            int a = (int)2e+9;
            if (g.count(r)) {
                a = g[r];
            }
            //cout << r << '\n';
            g[r] = min(c, a);
            r = "";
            for (int l = 0; l <= j; l++) {
                r += q[l];
            }
            a = (int)2e+9;
            if (g.count(r)) {
                a = g[r];
            }
            g[r] = min(c, a);
            //cout << r << '\n';
        }
    }
    //cout << '\n';
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < i; j++) {
            r = "";
            for (int l = j; l < i; l++) {
                r += w[l];
            }
            //cout << i << ' ' << j << ' ' << r << '\n';
            if (g.count(r)) {
                d[i] = min(d[i], d[j] + g[r]);
            }
        }
        //cout << d[i] << "\n\n";
    }
    if (d[n] == (long long)1e18) {
        d[n] = -1;
    }
    cout << d[n];
}

