#include <bits/stdc++.h>
using namespace std;
const long long MOD = (int)1e9 + 7, p = 533, INF = (long long)1e16;
long long dp[300001];
long long c[300000];
long long pref[300001], st[300001];
vector <long long> _pref[300000], _suf[300000];
string s[300000];
int main()
{
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    cin.tie();
    cout.tie();
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    int m, n, L;
    cin >> m >> n >> L;
    string str;
    cin >> str;
    pref[0] = 0;
    st[0] = 1;
    for (int i = 0; i < str.size(); i++)
    {
        pref[i + 1] = pref[i];
        pref[i + 1] *= p;
        pref[i + 1] %= MOD;
        pref[i + 1] += str[i];
        pref[i + 1] %= MOD;
    }
    for (int i = 0; i < max(m, L); i++)
    {
        st[i + 1] = st[i];
        st[i + 1] *= p;
        st[i + 1] %= MOD;
    }
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        cin >> s[i];
        _pref[i].assign(s[i].size() + 1, 0);
        _suf[i].assign(s[i].size() + 1, 0);
        for (int j = 0; j < s[i].size(); j++)
        {
            _pref[i][j + 1] = _pref[i][j];
            _pref[i][j + 1] *= p;
            _pref[i][j + 1] %= MOD;
            _pref[i][j + 1] += s[i][j];
            _pref[i][j + 1] %= MOD;
        }
        for (int j = 0; j < s[i].size(); j++)
        {
            _suf[i][j] = (_pref[i][j] - (_pref[i][j] * st[s[i].size() - j]) % MOD) % MOD;
            if (_suf[i][j] < 0)
            {
                _suf[i][j] += MOD;
                _suf[i][j] %= MOD;
            }
        }
    }
    dp[0] = 0;
    for (int i = 0; i < m; i++)
    {
        dp[i + 1] = INF;
    }
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < n; j++)
        {
            for (int k = 0; k < s[j].size(); k++)
            {
                if (i + k <= m && _pref[j][k] == ((pref[i + k] - (pref[i] * st[k]) % MOD) % MOD + MOD) % MOD)
                {
                    dp[i + k] = min(dp[i + k], dp[i] + c[j]);
                }
                if (i + s[j].size() - k <= m && _suf[j][k] == ((pref[i + s[j].size() - k] - (pref[i] * st[s[j].size() - k]) % MOD) % MOD + MOD) % MOD)
                {
                    dp[i + s[j].size() - k] = min(dp[i + s[j].size() - k], dp[i] + c[j]);
                }
            }
        }
    }
    if (dp[m] == INF)
        cout << -1;
    else
        cout << dp[m];
    return 0;
}
