#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;

const int LEN = 5010;
const int MLEN = 3e5 + 10;
const ll INF = 1e8 + 10;

ll d[LEN];
string a[MLEN];
ll c[MLEN];

int main() {
	freopen("typing.in", "rt", stdin);
	freopen("typing.out", "wt", stdout);
	int m, n, l;
	string s;
	scanf("%d%d%d", &m, &n, &l);

	cin >> s;
	s = " " + s;
	++m;

	for (int i = 0; i < m; ++i) {
		d[i] = INF;
	}
	d[0] = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%lld", &c[i]);
		cin >> a[i];
	}
	int p;
	for (int i = 0; i < m; ++i) {
		for (int k = 0; k < n; ++k) {
			p = a[k].size();

			for (int j = p - 1; j >= 0; --j) {
				if (i - (p - 1 - j) < 1) break;
				if (a[k][j] == s[i - (p - 1 - j)]) {
					d[i] = min(d[i], d[i - (p - 1 - j) - 1] + c[k]);
				} else break;
			}

			for (int j = 0; j < p; ++j) {
				if (i + j + 1 >= m) break;
				if (a[k][j] == s[i + j + 1]) {
					d[i + j + 1] = min(d[i + j + 1], d[i] + c[k]);
				} else break;
			}
		}
	}
	if (d[m - 1] == INF) printf("-1");
	else printf("%lld", d[m - 1]);

	return 0;
}