#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

using namespace std;

string s, u;

vector<string> g;

vector<int> cc;

vector<pair<int, int> > h, y;

long long d[100000];

int main() {
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    int n, m, k;
    cin >> n >> m >> k;
    cin >> s;
    for (int q = 0; q < m; q++) {
        int c;
        cin >> c;
        cc.push_back(c);
        cin >> u;
        g.push_back(u);
    }
    for (int i = 1; i <= n; i++) {
        d[i] = (long long)1e18;
        for (int j = 0; j < m; j++) {
            int l = -1;
            //cout << g[j][g[j].size() + l] << s[i + l] << ' ';
            while (l >= - g[j].size() && l >= -i && g[j][g[j].size() + l] == s[i + l]) {
                d[i] = min(d[i], d[i + l] + cc[j]);
                l--;
            }
        }
        pair<int, int> w;
        while (h.size() > 0) {
            w = h[h.size() - 1];
            h.pop_back();
            int a = w.first;
            int b = w.second;
            if (a < g[b].size() && g[b][a] == s[i - 1]) {
                d[i] = min(d[i - a - 1] + cc[b], d[i]);
                y.push_back({a + 1, b});
            }
        }
        for (int j = 0; j < m; j++) {
            if (s[i - 1] == g[j][0]) {
                y.push_back({1, j});
                d[i] = min(d[i], d[i - 1] + cc[j]);
            }
        }
        while (y.size() > 0) {
            h.push_back(y[y.size() - 1]);
            y.pop_back();
        }
    }
    if (d[n] == (long long)1e18) {
        d[n] = -1;
    }
    cout << d[n];
}

