#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

short m, n, L;
long long c[50010], d[400000];
string s[50010], a;

inline bool sr(short nom, short h, short p) {
	if (p + h - 1 >= m) {
		return 0;
	}
	short dl = s[nom].length();
	for (short i = 0; i < h; i++) {
		if (s[nom][dl - h + i] != a[p + i]) {
			return 0;
		}
	}
	return 1;
}

int main() {
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> m >> n >> L;
	cin >> a;
	for (short i = 0; i < n; i++) {
		cin >> c[i] >> s[i];
	}
	for (short i = 0; i <= m; i++) {
		d[i] = -1;
	}
	d[0] = 0;
	for (short i = 0; i < m; i++) {
		if (d[i] == -1) {
			continue;
		}
		for (short j = 0; j < n; j++) {
			short h = 0;
			while (i + h < m && h < s[j].length() && s[j][h] == a[i + h]) {
				if (d[i + h + 1] == -1) {
					d[i + h + 1] = d[i] + c[j];
				}
				d[i + h + 1] = min(d[i + h + 1], d[i] + c[j]);
				h++;
			}
			for (h = 1; h <= s[j].length(); h++) {
				if (sr(j, h, i)) {
					if (d[i + h] == -1) {
						d[i + h] = d[i] + c[j];
					}
					d[i + h] = min(d[i + h], d[i] + c[j]);
				}
			}
		}
	}
	cout << d[m];
	return 0;
}