#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define all(v) v.begin(), v.end()

const ll inf = 1e18;

ll d[50007];
int cost[300007];
vector<int> pf[300007];
string ex[300007];
char ob[50007];

vector<int> mp(string &s){
    vector<int> p;
    int n = p.size();
    p.resize(n);
    p[0] = 0;
    for (int i = 1; i < n; i++){
        int j = p[i - 1];
        while (j != 0 && s[j] != s[i]){
            j = p[j - 1];
        }
        if (s[i] == s[j]){
            j++;
        }
        p[i] = j;
    }
    return p;
}

int main(){
    //freopen("input.txt", "r", stdin);
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    int n, m, l;
    scanf("%d %d %d\n", &m, &n, &l);
    for (int i = 0; i < m; i++){
        scanf("%c", &ob[i]);
    }
    scanf("\n");
    for (int i = 0; i < n; i++){
        int t;
        scanf("%d ", &t);
        char x;
        cost[i] = t;
        ex[i] = "";
        scanf("%c", &x);
        while (x != '\n'){
            ex[i] += x;
            scanf("%c", &x);
        }
        string s = ex[i] + "#" + ob;
        pf[i] = mp(s);

    }
    d[0] = 0;
    for (int i = 1; i <= m; i++){
        d[i] = inf;
        for (int j = 0; j < n; j++){
            int sd = ex[j].size();
            for (int k = 0; k < sd; k++){
                int ind = (i - 1) - k;
                char ts = '#';
                if (ind >= 0){
                    ts = ob[ind];
                }
                if (ts != ex[j][sd - 1 - k]){
                    break;
                }
                d[i] = min(d[i], d[i - (k + 1)] + ll(cost[j]));
            }

            int q = pf[j][sd + i];
            while (q > 0){
                d[i] = min(d[i], d[i - q] + ll(cost[j]));
                q = pf[j][q - 1];
            }
        }
    }
    if (d[m] == inf){
        printf("-1");
    } else {
        printf("%lld", d[m]);
    }
    return 0;
}

