#include <iostream>
#include <vector>

using namespace std;

int main() {
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    int m, n, l;
    cin >> m >> n >> l;
    char buff[10000];
    scanf("%s", buff);
    vector<string> words(n);
    long long costs[n];
    for (int i = 0; i < n; i++) {
        cin >> costs[i] >> words[i];
    }
    long long dp_prefix[m + 1], dp_suffix[m + 1];
    dp_prefix[0] = dp_suffix[0] = 0;
    for (int i = 1; i <= m; i++) {
        dp_prefix[i] = dp_suffix[i] = 1e15;
    }
    for (int i = 1; i <= m; i++) {
        for (int j = 0; j < n; j++) {
            int curr_idx = words[j].length() - 1;
            while (curr_idx >= 0 and (curr_idx + i - words[j].length() >= 0) and words[j][curr_idx] == buff[curr_idx + i - words[j].length()]) {
                dp_suffix[i] = min(dp_suffix[i], min(dp_prefix[curr_idx + i - words[j].length()], dp_suffix[curr_idx + i - words[j].length()]) + costs[j]);
                curr_idx--;
            }
        }
        for (int j = 0; j < n; j++) {
            int curr_idx = 0;
            while (curr_idx < words[j].length() and curr_idx + i - 1 < m and words[j][curr_idx] == buff[i + curr_idx - 1]) {
                dp_prefix[i + curr_idx] = min(dp_prefix[i + curr_idx], min(dp_suffix[i - 1], dp_prefix[i - 1]) + costs[j]);
                curr_idx++;
            }
        }
    }
    if (min(dp_prefix[m], dp_suffix[m]) >= 1e15) {
        cout << -1 << endl;
    } else {
        cout << min(dp_prefix[m], dp_suffix[m]) << endl;
    }
}
