#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const ll INF = 2E18;
string s, s1;
vector<string> a;
vector<ll> b;
ll dp[300010], gg[300010], m, n;
ll get_ans(ll ind);
int main()
{
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    ll l, i, j, c, ans;
    cin >> n >> m >> l >> s;
    for (i = 0; i <= n; i++)
        dp[i] = -1;
    for (i = 0; i < m; i++)
    {
        cin >> c >> s1;
        for (j = s1.length() - 1; j >= 0; j--)
        {
            a.pb(s1.substr(j, s1.length() - j));
            b.pb(c);
        }

        for (j = 0; j < s1.length(); j++)
        {
            a.pb(s1.substr(0, j + 1));
            b.pb(c);
        }
    }
    dp[n] = 0;
    ans = get_ans(0);
    if (ans == INF)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}

ll get_ans(ll ind)
{
    if (dp[ind] != -1)
        return dp[ind];
    ll i, ans = INF;
    for (i = 0; i < b.size(); i++)
        if ((a[i].length() + ind <= n) && (get_ans(ind + a[i].length()) < INF) && (s.substr(ind, a[i].length()) == a[i]))
            ans = min(ans, b[i] + get_ans(ind + a[i].length()));

    dp[ind] = ans;
    return ans;
}
/*
9 2 8
000110100
1 100
1 11001


9 3 10
010110101
3 0101
10 011
2 100

3 1 3
100
1 101
*/
