#include <bits/stdc++.h>

using namespace std;

#define int int64_t

int n;
const int p = 239;
const long long mod = 999999991;


struct h_s
{
    vector<long long> h_arr;
    vector<long long> p_p;
    h_s(string s = "")
    {
        //cerr << "HASH " << s << ":\n";
        int n = s.length();
        h_arr.resize(n + 1, 0);
        p_p.resize(n + 1, 0);
        h_arr[0] = 0;
        p_p[0] = 1;
        for (int i = 1; i <= n; i++)
        {
            p_p[i] = (p_p[i - 1] * p) % mod;
            //cerr << p_p[i] << " ";
            h_arr[i] = (h_arr[i - 1] * p + s[i - 1]) % mod;
            //cerr << h_arr[i] << "\n";
        }
        //cerr << "\n";
    }
    int ss_h(int l, int r)
    {
        //cerr << l << " " << r << "\n";
        //cerr << r - l << " " << p_p[r - l] << "\n";
        //cerr << l << " " << h_arr[l] << "\n";
        //if (r < l)
            //cerr << "B_alloc\n";
        //if (p_p[r - l] >= mod)
            //cerr << "o_O!pp\n";
        //if (h_arr[l] >= mod)
            //cerr << "o_O!ha\n";
        //cerr << -h_arr[l] * p_p[r - l] + mod * mod << "\n";
        return ((h_arr[r] - h_arr[l] * p_p[r - l]) + mod * mod) % mod;
    }
};

int32_t main()
{
    ifstream cin("typing.in");
    ofstream cout("typing.out");
    int n, m, L;
    cin >> n >> m >> L;
    string s;
    cin >> s;
    h_s sh(s);
    unordered_map<int, int> mm;
    for (int i = 0; i < m; i++)
    {
        //cerr << i << " ";
        int c;
        cin >> c;
        string x;
        cin >> x;
        int n = x.size();
        h_s xh(x);
        for (int i = 1; i <= n; i++)
        {
            int h = xh.ss_h(0, i);
            if (mm.count(h) == 0) mm[h] = 1e9;
            mm[h] = min(mm[h], c);
        }
        for (int i = 0; i < n; i++)
        {
            int h = xh.ss_h(i, n);
            if (mm.count(h) == 0) mm[h] = 1e9;
            mm[h] = min(mm[h], c);
        }
    }
    long long dp[n + 1];
    dp[0] = 0;
    //cerr << "mm:\n";
    for (auto k : mm)
    {
        //cerr << k.first << " : " << k.second << "\n";
    }
    //cerr << "dp:\n";
    for (int i = 1; i <= n; i++)
    {
        dp[i] = 1e18;
        for (int j = 0; j < i; j++)
        {
            //cerr << i << " " << j << " : ";
            //cerr << dp[j] << " " << sh.ss_h(j, i) << "\n";
            if (dp[j] != 1e18 && mm.count(sh.ss_h(j, i)) == 1)
            {
                dp[i] = min(dp[i], dp[j] + mm[sh.ss_h(j, i)]);
            }
        }
    }
    if (dp[n] > 1e16)
    {
        cout << -1;
        return 0;
    }
    cout << dp[n];
    return 0;
}
