#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
using namespace std;

const int maxm = 55;
const int maxn = 55;
int dp[maxm][maxm];
string words[maxn];
int cost[maxn];
string s;

int main()
{
    freopen("typing.in","r",stdin);
    freopen("typing.out","w",stdout);
    int m,n,l;
    cin >> m >> n >> l;
    cin >> s;
    for(int i = 1; i <= n; ++i)
        cin >>cost[i] >>words[i];
    for(int i = 0; i < maxm; ++i)
        for(int i1 = 0; i1 < maxm; ++i1)
            dp[i][i1] = 1000000007;
    for(int i = 1; i <= n; ++i)
    {
        for(int i1 = 0; i1 < m; ++i1)
            for(int i2 = 0; i2 < m-i1 && i2 < words[i].size(); ++i2)
            {
                if(s[i1+i2] == words[i][i2])
                    dp[i1][i1+i2] = min(dp[i1][i1+i2],cost[i]);
                else
                    break;
            }
        for(int i1 = 0; i1 < m; ++i1)
            for(int i2 = 0; i2 <= i1 && i2 < words[i].size(); ++i2)
            {
                if(s[i1-i2] == words[i][words[i].size()-1-i2])
                    dp[i1-i2][i1] = min(dp[i1-i2][i1],cost[i]);
                else
                    break;
            }
    }
    for(int i = 0; i < m; ++i)
    {
        for(int i1 = 0; i1 < i; ++i1)
            dp[0][i] = min(dp[0][i],dp[0][i1]+dp[i1+1][i]);
    }
    if(dp[0][m-1] < 1000000007)
        cout << dp[0][m-1];
    else
        cout << -1;
    return 0;
}
