#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;

const long long BIG_NUMBER = 1000000000000000;

struct begining
{
    string pref;
    long long prev;
    long long coord, num;
};

int main()
{
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);


    long long n, m, L, i, j, k, p;
    cin >> m >> n >> L;
    string nabor;
    cin >> nabor;
    set < pair <long long, string> > keypad;
    long long a;
    string b;
    for(i = 0; i < n; i++)
    {
        cin >> a >> b;
        keypad.insert({a, b});
        reverse(b.begin(), b.end());
        keypad.insert({a, b});
    }

    vector <long long> dp(m, BIG_NUMBER);
    for(i = 0; i < m; i++)
    {
        long long prev_ans = (i == 0) ? 0 : dp[i - 1];
        for(auto j: keypad)
        {
            for(k = 0; k < j.second.size() and i + k < m; k++)
            {
                bool flag = true;
                for(p = 0; p <= k; p++)
                {
                    if(nabor[i + p] != j.second[p])
                    {
                        flag = false;
                    }
                }
                if(flag)
                {
                    dp[i + k] = min(dp[i + k], prev_ans + j.first);
                }
            }
        }
        if(dp[i] > 50000)
        {
            cout << -1;
            return 0;
        }
    }

    if(dp[m - 1] > 50000)
        cout << -1;
    else
        cout << dp[m - 1];
    return 0;

}
