#include <bits/stdc++.h>

#define TASK "typing"
using namespace std;
typedef long long ll;
typedef long double ld;

ll pend = 1;
ll dp[345678];
string mas[345678];
ll c[345678];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    if(strcmp(TASK,"")!=0)
    {
        freopen(TASK".in","r",stdin);
        freopen(TASK".out","w",stdout);
    }
#endif
    ll m, n, l;
    cin >> m >> n >> l;
    string s;
    cin >> s;
    for (int i = 0; i < 345678; i++)
    {
        dp[i] = 1e18;
    }
    dp[0] = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> c[i] >> mas[i];
    }
    set<pair<ll, ll>> st;
    for (int i = 0; i <= s.size(); i++)
    {
        if(i!=0)
        {
            while (!st.empty() && st.begin()->second <= i)
            {
                st.erase(st.begin());
            }
            if (st.empty())break;
            dp[i] = st.begin()->first;
        }
        for (int j = 0; j < n; j++)
        {
            int k2 = 0;
            for (; k2 < mas[j].size() && i + k2 < s.size() && mas[j][k2] == s[i + k2];)
            {
                k2++;
            }
            int k3 = 0;

            for (; k3 < mas[j].size() && i + k3 < s.size() && mas[j][mas[j].size() - 1 - k3] == s[i + k3];)
            {
                k3++;
            }
            st.insert(make_pair(c[j]+dp[i], i + max(k2,k3)));
        }
    }
    if (dp[s.size()] >= 1e18)
    {
        cout << -1;
    }
    else cout << dp[s.size()];
    return 0;
}