#include <bits/stdc++.h>

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 <long long, string> > c(n);
    for (int i = 0; i < n; i++)
    {
        cin >> c[i].first >> c[i].second;
    }
    //sort(c.begin(), c.end());
    vector <long long> ans(m, 1000000000000);
    for (int i = 0; i < m; i++){
        string s1 = "";
        for (int j = 0; j < m; j++){
            if (i + j <= int(s.size())){;
            s1 += s[i+j];
            for (int q = 0; q < n; q++){
                string sp = "", ss = "";
                if (s1.size() <= c[q].second.size()){
                    for (int k = 0; k < s1.size(); k++){
                        sp += c[q].second[k];
                        ss = c[q].second[int(c[q].second.size())-1-k] + ss;
                    }
                    if (ss == s1 || sp == s1){
                        if (ans[i-1] != 0) ans[i+j] = min(ans[i+j], ans[i-1] + c[q].first);
                        else ans[i+j] = min(ans[i+j], c[q].first);
                    }
                }
            }
            }
        }
    }
    if (ans[m-1] != 1000000000000) cout << ans[m-1] << "\n";
    else cout << -1 << "\n";
    return 0;
}
