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

using namespace std;

string s;
string a[100013];
long long c[100013];
long long out[100013];
long long n, m, L;

int main() {
	//freopen("1.txt", "r", stdin);
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	
	cin >> n >> m >> L;
	cin >> s;

	for (long long i = 0; i < n + 10; i++) {
		out[i] = 1000000000000000000;
	}

	for (long long i = 0; i < m; i++) {
		cin >> c[i] >> a[i];
	}

	out[0] = 0;

	for (long long i = 0; i <= n; i++) {
		for (long long j = 0; j < m; j++) {
			long long ind1 = 0, ind2 = 0;
			while (ind1 < a[j].size() && ind1 + 1 <= i && s[i - ind1 - 1] == a[j][a[j].size() - ind1 - 1]) {
				out[i] = min(out[i], out[i - ind1 - 1] + c[j]);
				ind1++;
			}

			while (ind2 < a[j].size() && ind2 < s.size() - i && s[ind2 + i] == a[j][ind2]) {
				out[ind2 + i + 1] = min(out[ind2 + i + 1], out[i] + c[j]);
				ind2++;
			}
		}
	}

	if (out[n] == 1000000000000000000) {
		cout << -1 << endl;
		return 0;
	}
	cout << out[n] << endl;
	return 0;
}