#include <bits/stdc++.h>
#define puba push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long
using namespace std;
const int N=10000;
const ll INF=1e16;
vector<pii> vel[N];
string txt;
int len,zv[N];
vector<ll> dp(N,INF);

void zfun(string &s, int c)
{
    int n=(int)s.length();
    for(int i=0,l=0,r=0; i<len; i++)
    {
        zv[i]=0;
        if(i<=r)
            zv[i]=min(r-i,zv[i-l+1]);
        while(zv[i]<n&&i+zv[i]<len&&s[zv[i]]==txt[i+zv[i]])
            zv[i]++;
        if(i+zv[i]-1>r)
            l=i,r=i+zv[i]-1;
    }

    for(int i=0; i<len; i++)
        if(zv[i]==n)
            vel[i].puba({zv[i],c}); // LEN COST
/*
   cout<<s<<endl;
    for(int i=0; i<len; i++)
        cout<<zv[i]<<' ';
    cout<<endl<<endl;
*/
}

int main()
{
    ios_base::sync_with_stdio(0);
    //ifstream cin("input.txt");
    //ofstream cout("output.txt");
    ifstream cin("typing.in");
    ofstream cout("typing.out");

    int n,L;
    cin>>len>>n>>L;
    cin>>txt;

    string s1,s2;
    for(int i=0; i<n; i++)
    {
        int c;
        cin>>c>>s1;
        s2=s1;
        int slen=(int)s1.length();
        zfun(s1,c);
        for(int j=1; j<slen; j++)
            s1.erase(0,1),
            zfun(s1,c);
        for(int j=1; j<slen; j++)
            s2.erase(s2.length()-1),
            zfun(s2,c);
    }

    for(int i=0; i<len; i++)
        if(i==0||dp[i-1]!=INF)
            for(int j=0,sz=(int)vel[i].size(); j<sz; j++)
                dp[i+vel[i][j].ff-1]=min(dp[i+vel[i][j].ff-1],(i?dp[i-1]:0ll)+vel[i][j].ss);

    if(dp[len-1]==INF)
        cout<<-1;
    else
        cout<<dp[len-1];
    return 0;
}
