#include <iostream>
#include <vector>
#include <string>
#include <fstream>

using namespace std;

ifstream in("typing.in");
ofstream out("typing.out");

const int INF = 1e9;
string need;
vector <pair <int, string> > wo;

bool equ(int st, int leng, int noo){
    bool toret1 = true, toret2 = true;
    for (int i = 0; i < leng; i++){
        if (need[i + st] != wo[noo].second[i]){
            toret1 = false;
        }
        if (need[i + st] != wo[noo].second[wo[noo].second.size() - leng + i]){
            toret2 = false;
        }
    }
    return toret1 || toret2;
}

int main(){
    int n, m, l;
    in >> n >> m >> l;
    in >> need;
    vector <int> d(n + 1, INF);
    d[0] = 0;
    for (int i = 0; i < m; i++){
        string tin;
        int cotin;
        in >> cotin >> tin;
        wo.push_back(make_pair(cotin, tin));
    }
    for (int i = 1; i < n + 1; i++){
        for (int j = 0; j < i; j++){
            for (int k = 0; k < m; k++){
                if (equ(j, i - j, k)){
                    d[i] = min(d[j] + wo[k].first, d[i]);
                }
            }
        }
    }
    /*for (int i = 0; i < n + 1; i++){
        cout << d[i] << " ";
    }*/
    if (d[n] != INF){
        out << d[n];
    }
    else {
        out << -1;
    }
}
