#include <iostream>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

const int N = 2e5, INF = 1e9 + 7;

int dp[N];
string s, s1, s2;

vector <pair <int, string> > a;

int main()
{
    int n, k, m;
    ios_base::sync_with_stdio(0);
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    cin >> n >> k >> m;
    cin >> s;
    for (int i = 0; i < k; i++)
    {
        int f;
        cin >> f >> s1;
        a.push_back(make_pair(f, s1));
        reverse(s1.begin(), s1.end());
        a.push_back(make_pair(f, s1));
    }
    for (int i = 0; i <= n; i++)
        dp[i] = INF;
    dp[0] = INF;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < a.size(); j++)
        {
            int i1 = i, i2 = 0;
            s2 = a[j].second;
            while (s[i1] == s2[i2] && i1 < n && i2 < s2.size())
            {
                int k1 = dp[i - 1];
                if (i - 1 < 0)
                    k1 = 0;
                dp[i1] = min(dp[i1], k1 + a[j].first);
                i1++, i2++;
            }
        }
    if (dp[n - 1] == INF)
        cout << -1 << endl;
    else
        cout << dp[n - 1] << endl;
    return 0;
}
