#include <bits/stdc++.h>

using namespace std;

#define int long long
#define mp make_pair
#define pb push_back

string t[1000];
int c[1000];

int d[300001];
signed main()
{
//
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);

    ios_base::sync_with_stdio(0);
    cin.tie(0);


    int m, n, l;
    cin >> m >> n >> l;
    string s;

    cin >> s;
    s = ' ' + s;
    for (int i = 0; i < n; ++i)
        cin >> c[i] >> t[i];

    int kek = (long long)1000000000 * (long long) 1000000000 + (long long) 228;
    for (int i = 0; i <= m; ++i)
        d[i] = kek;

    for (int i = 0; i < n; ++i)
        t[i] = ' ' + t[i];

    d[0] = 0;
    for (int i = 0; i < m; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            int k = (int)t[j].size() - 1;
            int it;

            it = 0;
            while (it < k && t[j][it + 1] == s[i + it + 1])
                it++;
            for (int p = 1; p <= it)
                d[i + p] = min(d[i + p], d[i] + c[j]);

            it = 0;
            while (it < k && t[j][k - it] == s[i + it + 1])
                it++;
            for (int p = 1; p <= it)
                d[i + p] = min(d[i + p], d[i] + c[j]);

//            int it = -1;
//            while (it <((int)t[j].size() - 1) && t[j][it + 1] == s[i + it + 1])
//                it++;
//            if (it >= 0 && (i + it + 1 <= m))
//                d[i + it + 1] = min(d[i + it + 1], d[i] + c[j]);
//            it = -1;
//            while (it <((int)t[j].size() - 1) && t[j][(int)t[j].size() - it - 2] == s[i + it + 1])
//                it++;
//            if (it >= 0 && (i + it + 1 <= m))
//                d[i + it + 1] = min(d[i + it + 1], d[i] + c[j]);
        }
    }
    if (d[m] == kek)
        cout << -1;
    else
        cout << d[m];

}
