#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <math.h>
#include <cstring>
#define mp make_pair
using namespace std;

int n, m, l;
string s, ss;
map <string, long long> gg;
vector <long long> dp;

int main()
{
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    long long a;
    cin >> n >> m >> l;
    dp.resize(n + 1, -1);
    cin >> s;
    for (int i = 0; i < m; i++)
    {
        cin >> a >> ss;
        string t = "";
        for (int j = 0; j < ss.size(); j++)
        {
            t = t + ss[j];
            if (gg[t] == 0)
                gg[t] = a;
            gg[t] = min(gg[t], a);
        }
        t = "";
        for (int j = ss.size() - 1; j >= 0; j--)
        {
            t = ss[j] + t;
            if (gg[t] == 0)
                gg[t] = a;
            gg[t] = min(gg[t], a);
        }
    }
    dp[0] = 0;
    for (int i = 1; i <= n; i++)
    {
        string t = "";
        for (int j = i - 1; j >= 0; j--)
        {
            t = s[j] + t;
            if (dp[i - t.size()] != -1 && gg[t] != 0)
            {
                long long tmp = dp[i - t.size()] + gg[t];
                if (dp[i] == -1)
                    dp[i] = tmp;
                dp[i] = min(dp[i], tmp);
            }
        }
    }
    //for (int i = 0; i <= n; i++)
    //    cout << dp[i] << " ";
    cout << dp[n];
}
