#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

const int MAXN = 52;
string mas;
long long dp[MAXN];
map <string, int> st;
int main(){
    ios_base::sync_with_stdio(false);
    sfreopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    int n, m, l;
    cin >> n >> m >> l;
    cin >> mas;
    for (int i = 0; i < m; i++){
        int k;
        string s;
        cin >> k >> s;
        string curs = "";
        for (int j = 0; j < min((n), (int)s.size()); j++){
            curs += s[j];
            if (st.count(curs) == 1){
                st[curs] = min(st[curs], k);
            }
            else{
                st[curs] = k;
            }
        }
        curs = "";
        for (int j = s.size() - 1; j >= max(0, ((int)s.size() - (n))); j--){
            curs += s[j];
            reverse(curs.begin(), curs.end());
            if (st.count(curs) == 1){
                st[curs] = min(st[curs], k);
            }
            else{
                st[curs] = k;
            }
            reverse(curs.begin(), curs.end());
        }
    }
    for (int i = 0; i < n; i++){
        string s;
        for (int j = 0; j <= i; j++){
            s += mas[j];
        }
        if (st.count(s) == 0){
            dp[i] = 100000000000000;
        }
        else{
            dp[i] = st[s];
        }
        for (int j = 0; j < i; j++){
            string s;
            for (int k = j + 1; k <= i; k++){
                s += mas[k];
            }
            if (st.count(s) == 1){
                dp[i] = min(dp[i], dp[j] + st[s]);
            }
        }
    }
    if (dp[n - 1] == 100000000000000){
        cout << -1;
    }
    else{
        cout << dp[n - 1];
    }
}
