#include <bits/stdc++.h>

using namespace std;

const int p = 257;

long long powp[300005];

int m, n, L;
string s;
int shash[300005];
string sarr[300005];
int cost[300005];

long long dyn[300005];

unordered_map<int, int> hash_cost;

inline int hash_s(int b, int e)
{
    return shash[e-1] - (shash[b-1] * powp[e-b]);
}

void upd_hash(int h, int c)
{
    if(!hash_cost.count(h))
    {
        hash_cost[h] = c;
    }
    else
        hash_cost[h] = min(hash_cost[h], c);
}

void add_hashes(string s, int c)
{
    int h = 0;
    for(int i=0;i<s.size();i++)
    {
        h *= p;
        h += s[i];
        upd_hash(h, c);
    }
    h = 0;
    int pp = 0;
    for(int i=s.size()-1;i;i--)
    {
        h += s[i] * powp[pp];
        upd_hash(h, c);
        pp++;
    }
}

inline long long get_cost(int h)
{
    if(hash_cost.count(h))
        return hash_cost[h];
    return 5e18;
}

int main()
{
    ios_base::sync_with_stdio(0);
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    cin >> m >> n >> L;
    cin >> s;
    powp[0] = 1;
    shash[0] = s[0];
    for(int i=1;i<m;i++)
    {
        powp[i] = powp[i-1] * p;
        shash[i] = shash[i-1] * p + s[i];
    }
    for(int i=0;i<n;i++)
    {
        cin >> cost[i] >> sarr[i];
        add_hashes(sarr[i], cost[i]);
    }

    dyn[0] = get_cost(s[0]);
    for(int i=1;i<m;i++)
    {
        dyn[i] = get_cost(hash_s(0, i+1));
        for(register int j=0;j<i;j++)
        {
            if(dyn[j] > 4e18)
                continue;
            long long t = dyn[j] + get_cost(hash_s(j+1, i+1));
            if(t < dyn[i])
                dyn[i] = t;
        }
    }
    if(dyn[m-1] > 4e18)
    {
        cout << -1;
        return 0;
    }
    cout << dyn[m-1];
    return 0;
}
