#include <bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
int m, n, l;
ll inf = 1000000000000000000;
ll x = 37, p = 1000000007;
string s;
string t[300000];
ll c[300000];
ll a[300001];
ll deg[300000];
vector <ll> hashes[300000];
ll dp[300001];
void hs(string s) {
    a[0] = 0;
    for (int i = 0; i < m; i++) a[i + 1] = (a[i] * x + s[i]) % p;
}
ll get(int l, int r) {
    r++;
    return (p * deg[r - l] + a[r] - a[l] * deg[r - l]) % p;
}
void h(int j) {
    hashes[j].pb(0);
    for (int i = 0; i < t[j].size(); i++) hashes[j].pb((hashes[j][i] * x + t[j][i]) % p);
}
ll geth(int i, int l, int r) {
    r++;
    return (p * deg[r - l] + hashes[i][r] - hashes[i][l] * deg[r - l]) % p;
}
int main() {
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    deg[0] = 1;
    for (int i = 1; i < 300000; i++) deg[i] = (deg[i - 1] * x) % p;
    cin >> m >> n >> l;
    cin >> s;
    hs(s);
    for (int i = 0; i < n; i++) cin >> c[i] >> t[i];
    for (int i = 0; i < n; i++) h(i);
    fill(dp, dp + m + 1, inf);
    dp[0] = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j <= i; j++) {
            for (int k = 0; k < n; k++) {
                if (get(j, i) == geth(k, 0, i - j) || get(j, i) == geth(k, t[k].size() - i + j - 1, t[k].size() - 1)) dp[i + 1] = min(dp[i + 1], dp[j] + c[k]);
            }
        }
    }
    //for (int i = 0; i < m; i++) cout << dp[i + 1] << "\n";
    if (dp[m] == inf) cout << "-1\n";
    else cout << dp[m] << "\n";
}
