#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;



int main()
{
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    int m, n, L;
    cin >> m >> n >> L;
    string s;
    cin >> s;
    vector <pair <string, int> > v;
    for (int i = 0; i < m; i++){
        string s1;
        int c;
        cin >> c >> s1;
        for (int j = 0; j < (int)s1.size(); j++)
            v.push_back(make_pair(s1.substr(j, (int)s1.size()), c));
        reverse(s1.begin(), s1.end());
        for (int j = 0; j < (int)s1.size(); j++)
            v.push_back(make_pair(s1.substr(j, (int)s1.size()), c));
    }
    int d[100];
    for (int i = 1; i <= m; i++)
        d[i] = 1000000000;
    d[0] = 0;
    for (int i = 1; i <= m; i++){
        for (int j = 0; j < (int)v.size(); j++){
            string s1 = v[j].first;
            int c = v[j].second;
            int i1 = i - 1, i2 = (int)s1.size() - 1;
            while (i1 >= 0 && i2 >= 0 && s[i1] == s1[i2]){
                i1--;
                i2--;
            }
            if (i2 != -1)
                continue;
            d[i] = min(d[i], d[i1 + 1] + c);
        }
    }
    if (d[m] >= 1000000)
        cout << -1;
    else
        cout << d[m] << endl;
    return 0;
}
