#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll dp[100005];

pair <string, ll> st[100005];

const ll inf = 1e9 + 7;

void rev(string &s) {
    for(int i = 0; i < (int)s.size() / 2; i++) {
        swap(s[i], s[(int)s.size() - 1 - i]);
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    ll m, n, L;
    cin >> m >> n >> L;
    string s;
    cin >> s;
    for(int i = 0; i < m; i++) {
        //cout << "HI" << endl;
        dp[i] = inf;
    }
    for(int i = 0; i < n; i++) {
        cin >> st[i].second >> st[i].first;
        if (st[i].first[0] == s[0]) {
            dp[0] = min(dp[0], st[i].second);
        }
        if (st[i].first[(int)(st[i].first).size() - 1] == s[0]) {
            dp[0] = min(dp[0], st[i].second);
        }
    }
    sort(st, st + n);
    for(int i = 1; i < m; i++) {
        string s2;
        for(int j = i; j >= 0; j--) {
            s2 += s[j];
            rev(s2);
            for(int k = 0; k < n; k++) {
                bool fl = true;
                string s3 = st[k].first;
                int id = j;
                for(int ch = 0; ch < i - j + 1; ch++) {
                    if (s3[ch] != s[id]) {
                        fl = false;
                        break;
                    }
                    id++;
                }
                if (fl) {
                    if (j != 0) dp[i] = min(dp[i], dp[j - 1] + st[k].second);
                    else {
                        dp[i] = min(dp[i], st[k].second);
                    }
                }
                fl = true;
                s3 = st[k].first;
                 id = j;
                int id2 = (int)s3.size() - 1;
                for(int ch = 0; ch < i - j + 1; ch++) {
                    if (s3[id2] != s[id]) {
                        fl = false;
                        break;
                    }
                    id++;
                    id2--;
                }
                if (fl) {
                    if (j != 0) dp[i] = min(dp[i], dp[j - 1] + st[k].second);
                    else {
                        dp[i] = min(dp[i], st[k].second);
                    }
                }
            }
            rev(s2);
        }
    }
    if (dp[m - 1] == inf) {
        cout << -1;
        return 0;
    }
    cout << dp[m - 1];
    return 0;
}
