#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

const int INF = 1000 * 1000 * 1000;

int main()
{
    freopen("typing.in", "rt", stdin);
    freopen("typing.out", "wt", stdout);
    int n, m, L;
    cin >> n >> m >> L;
    string s;
    cin >> s;
    vector<string> words;
    vector<int> price;
    int maxl = 0;
    for (int i = 0; i < m; i++) {
        int c;
        string w1, w2;
        cin >> c >> w1;
        w2 = w1;
        reverse(w1.begin(), w1.end());
        words.push_back(w1);
        words.push_back(w2);
        price.push_back(c);
        price.push_back(c);
        maxl = max(maxl, int(w1.size()));
    }
    m *= 2;
    vector<vector<vector<int> > > d(n, vector<vector<int> >(m, vector<int>(maxl, INF)));
    for (int j = 0; j < m; j++) {
        if (words[j][0] == s[0]) {
            d[0][j][0] = price[j];
        }
    }
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < m; j++) {
            int l = int(words[j].size());
            if (words[j][0] == s[i]) {
                int minx = INF;
                for (int j1 = 0; j1 < m; j1++) {
                    minx = min(minx, *(min_element(d[i - 1][j1].begin(), d[i - 1][j1].end())));
                }
                d[i][j][0] = price[j] + minx;
            }
            for (int pos = 1; pos < l; pos++) {
                if (s[i] == words[j][pos]) {
                    d[i][j][pos] = min(d[i][j][pos], d[i - 1][j][pos - 1]);
                }
            }
        }
    }
    int ans = INF;
    for (int j = 0; j < m; j++) {
        int l = int(words[j].size());
        for (int pos = 0; pos < l; pos++) {
            ans = min(ans, d.back()[j][pos]);
        }
    }
    if (ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}
