#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cstdlib>
#include <iomanip>

using namespace std;

#define int long long
map <string, int> mmm;
const int INF = 1234567890123456789;
signed main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

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

	int m, n, L;
	cin >> m >> n >> L;
	string hh;
	cin >> hh;
	for (int i = 1; i <= n; ++i) {
		int k;
		string s;
		cin >> k >> s;
		for (int i = 0; i < s.size(); ++i) {
			if (mmm.count(s.substr(0, i + 1))) {
				mmm[s.substr(0, i + 1)] = min(mmm[s.substr(0, i + 1)], k);
			}
			else {
				mmm[s.substr(0, i + 1)] = k;
			}
		}
		for (int i = s.size() - 1; i > 0; --i) {
			if (mmm.count(s.substr(i, s.size() - i))) {
				mmm[s.substr(i, s.size() - i)] = min(mmm[s.substr(i, s.size() - i)], k);
			}
			else {
				mmm[s.substr(i, s.size() - i)] = k;
			}
		}
	}
	hh = 'a' + hh;
	vector <int> dp(hh.size(), INF);
	dp[0] = 0;
	for (int i = 1; i <= m; ++i) {
		for (int j = max(1LL, i - 1000); j <= i; ++j) {
			if (mmm.count(hh.substr(j, i - j + 1))) {
				dp[i] = min(dp[i], dp[j - 1] + mmm[hh.substr(j, i - j + 1)]);
			}
		}
	}
	cout << (dp[m] == INF ? -1 : dp[m]) << endl;
}