#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

int p1 = 239;
int MOD1 = 1000000007;
int p2 = 101;
int MOD2 = 1000000009;

vector<long long> pp1, pp2;
vector<vector<long long>> pref1, suf1, pref2, suf2;
vector<long long> ph1, ph2;

vector<long long> it;

pair<long long, long long> hsh(int L, int R) {
	long long hsh1 = (ph1[R] - ph1[L] * pp1[R - L]) % MOD1;
	long long hsh2 = (ph2[R] - ph2[L] * pp2[R - L]) % MOD2;
	if (hsh1 < 0) hsh1 += MOD1;
	if (hsh2 < 0) hsh2 += MOD2;
	return {hsh1, hsh2};
}

void upd(int u, int L, int R, int ind, long long val) {
	if (R - L == 1) {
		it[u] = min(it[u], val);
		return;
	}
	int M = (R + L) / 2;
	if (ind < M) {
		upd(2 * u + 1, L, M, ind, val);
	} else {
		upd(2 * u + 2, M, R, ind, val);
	}
	it[u] = min(it[2 * u + 1], it[2 * u + 2]);
}

long long getMin(int u, int L, int R, int left, int right) {
	if (L >= right || left >= R) {
		return LONG_MAX / 2;
	}
	if (left <= L && R <= right) {
		return it[u];
	}
	int M = (R + L) / 2;
	return min(getMin(2 * u + 1, L, M, left, right), getMin(2 * u + 2, M, R, left, right));
}

int main() {
	freopen("typing.in", "r", stdin);
	#ifndef DEBUG
	freopen("typing.out", "w", stdout);
	#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int m, n, L;
	cin >> m >> n >> L;
	string s;
	cin >> s;
	ph1.resize(m + 1);
	ph2.resize(m + 1);
	long long curh1 = 0, curh2 = 0;
	for (int i = 0; i < m; i++) {
		curh1 = (curh1 * p1 + (s[i] - '0' + 1)) % MOD1;
		curh2 = (curh2 * p2 + (s[i] - '0' + 1)) % MOD2;
		ph1[i + 1] = curh1;
		ph2[i + 1] = curh2;
	}
	pref1.resize(n);
	suf1.resize(n);
	pref2.resize(n);
	suf2.resize(n);
	pp1.resize(L + 1);
	pp1[0] = 1;
	pp2.resize(L + 1);
	pp2[0] = 1;
	for (int i = 0; i < L; i++) {
		pp1[i + 1] = pp1[i] * p1 % MOD1;
		pp2[i + 1] = pp2[i] * p2 % MOD2;
	}
	//unordered_map<long long, int> hashes;
	vector<string> a(n);
	vector<int> c(n);
	for (int i = 0; i < n; i++) {
		//int c;
		cin >> c[i];
		cin >> a[i];
		pref1[i].resize(a[i].length() + 1);
		suf1[i].resize(a[i].length() + 1);
		pref2[i].resize(a[i].length() + 1);
		suf2[i].resize(a[i].length() + 1);
		long long curh1 = 0, curh2 = 0;
		for (int j = 0; j < a[i].length(); j++) {
			curh1 = (curh1 * p1 + (a[i][j] - '0' + 1)) % MOD1;
			curh2 = (curh2 * p2 + (a[i][j] - '0' + 1)) % MOD2;
			pref1[i][j + 1] = curh1;
			pref2[i][j + 1] = curh2;
		}
		curh1 = 0;
		curh2 = 0;
		for (int j = a[i].length() - 1; j >= 0; j--) {
			curh1 = (curh1 + (a[i][j] - '0' + 1) * pp1[a[i].length() - 1 - j]) % MOD1;
			curh2 = (curh2 + (a[i][j] - '0' + 1) * pp2[a[i].length() - 1 - j]) % MOD2;
			suf1[i][j] = curh1;
			suf2[i][j] = curh2;
		}
	}
	
	vector<long long> dp(m + 1, LONG_MAX / 2);
	dp[0] = 0;
	it.resize(4 * (m + 1));
	fill(it.begin(), it.end(), LONG_MAX / 2);
	upd(0, 0, m + 1, 0, 0);
	for (int i = 0; i <= m; i++) {
		// suf
		for (int j = 0; j < n; j++) {
			int L = 0;
			int R = min(i, (int) a[j].length()) + 1;
			while (R - L > 1) {
				int M = (R + L) / 2;
				if (make_pair(suf1[j][a[j].length() - M], suf2[j][a[j].length() - M]) == hsh(i - M, i)) {
					L = M;
				} else {
					R = M;
				}
			}
			dp[i] = min(dp[i], getMin(0, 0, m + 1, i - L, i + 1) + c[j]);
			upd(0, 0, m + 1, i, dp[i]);
		}
		
		// pref
		for (int j = 0; j < n; j++) {
			int L = 0;
			int R = min(m - i, (int) a[j].length()) + 1;
			while (R - L > 1) {
				int M = (R + L) / 2;
				if (make_pair(pref1[j][M], pref2[j][M]) == hsh(i, i + M)) {
					L = M;
				} else {
					R = M;
				}
			}
			dp[i + L] = min(dp[i + L], dp[i] + c[j]);
			upd(0, 0, m + 1, i + L, dp[i + L]);
		}
	}
	if (dp[m] == LONG_MAX / 2) {
		cout << -1 << endl;
	} else {
		cout << dp[m] << endl;
	}
	
	return 0;
}
