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

using namespace std;

map <long long, long long> q;

const long long p = 239;
const long long w = 1e9 + 7;
vector < vector < long long > > hs;
vector < long long > pw;

long long geths(long long i, long long l, long long r) {
	if (!l)
		return hs[i][r];
	long long h = (hs[i][r] - (hs[i][l - 1] * pw[r - l + 1]) % w) % w;
	if (h < 0)
		h += w;
	return h;
}

int main() {
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	vector <long long> dp;
	vector <string> voc;
	vector < long long > prc;
	string s;
	long long n, m, l;
	cin >> m >> n >> l;
	pw.resize(m + 1);
	pw[0] = 1;
	for (long long i = 1; i < m + 1; i++) {
		pw[i] = (pw[i - 1] * p) % w;
	}
	voc.resize(n);
	prc.resize(n);
	cin >> s;
	hs.resize(n + 1);
	hs[0].resize(m);
	hs[0][0] = s[0];
	for (long long i = 1; i < m; i++) {
		hs[0][i] = (hs[0][i - 1] * p + s[i]) % w;
		if (hs[0][i] < 0)
			hs[0][i] += w;
	}
	for (long long i = 0; i < n; i++) {
		cin >> prc[i] >> voc[i];
		hs[i + 1].resize(voc[i].length());
		hs[i + 1][0] = voc[i][0];
		for (long long j = 1; j < voc[i].length(); j++) {
			hs[i + 1][j] = (hs[i + 1][j - 1] * p + voc[i][j]) % w;
			if (hs[i + 1][j] < 0)
				hs[i + 1][j] += w;
		}
		for (long long j = 0; j < voc[i].length(); j++) {
			for (long long k = j; k < voc[i].length(); k++) {
				long long x = geths(i + 1, j, k);
				if (q[x] == 0 || q[x] > prc[i])
					q[x] = prc[i];
			}
		}
	}
	dp.resize(m + 1, 1e18);
	dp[m] = 0;
	for (long long i = m - 1; i >= 0; i--) {
		for (long long j = 1; j <= m - i; j++) {
			long long x = 1e18;
			long long y = geths(0, i, i + j - 1);
			if (q[y] != 0)
				x = q[y];
			dp[i] = min(dp[i], dp[i + j] + x);
		}
	}
	if (dp[0] == 1e18)
		cout << -1;
	else
		cout << dp[0];
	return 0;
}