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

using namespace std;

int main() {
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	int m, n, l;
	cin >> m >> n >> l;
	string s;
	cin >> s;
	vector< pair< string , int> > arr(n);
	for (int i = 0; i < n; i++) {
		cin >> arr[i].second >> arr[i].first;
	}
	vector< vector< vector<short int> > > suf(m);
	vector< vector<short int> > pref(m);
	for (int i = 0; i < m; i++) {
		suf[i].resize(n);
		pref[i].resize(n);
	}
	string h = "";
	for (int q = m - 1; q >= 0; q--) {
		h = s[q] + h;
		string t = h;
		t += '2';
		for (int i = 0; i < n; i++) {
			t += arr[i].first;
			t += '3';
		}
		int u = t.length();
		vector<int> z(u);
		int l = 0, r = 0;
		for (int i = 1; i < t.length(); i++) {
			if (i <= r) { z[i] = min(z[i - l], r - i + 1); }
			while (i + z[i] < u && t[i + z[i]] == t[z[i]]) { z[i]++; }
			if (i + z[i] > r) {
				r = i + z[i] - 1;
				l = i;
			}
		}
		int j = -1;
		for (int i = h.length() + 1; i < u; i++) {
			if (t[i - 1] == '3' || t[i - 1] == '2') { j++; pref[q][j] = z[i]; }
			if (t[i + z[i]] == '3') { suf[q][j].push_back(z[i]); }
		}
	}
	vector<long long> dp(m + 1, 2000000000000000000);
	dp[0] = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			for (int q = 1; q <= pref[i][j]; q++) {
				dp[i + q] = min(dp[i + q], dp[i] + arr[j].second);
			}
			for (int q = 0; q < suf[i][j].size(); q++) {
				int a = suf[i][j][q];
				dp[i + a] = min(dp[i + a], dp[i] + arr[j].second);
			}
		}
	}
	if (dp[m] == 2000000000000000000) { cout << -1; }
	else {
		cout << dp[m];
	}
	return 0;
}