#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

typedef pair <long long, long long> pii;
const long long mn = 100010;
const long long MINT = 1000000000000000000;
long long m, n;
long long c[mn], l, dp[mn];
string s, w[mn];

long long min2(long long x, long long y) {
	if (x < y) {
		return x;
	}
	return y;
}

int main() {
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	cin >> m >> n >> l;
	cin >> s;
	for (long long i = 0; i <= m; i++) {
		dp[i] = MINT;
	}
	for (long long i = 0; i < n; i++) {
		cin >> c[i] >> w[i];
		c[i + n] = c[i];
		w[i + n] = "";
		for (long long j = w[i].size() - 1; j >= 0; j--) {
			w[i + n].push_back(w[i][j]);
		}
	}
	n *= 2;
	dp[0] = 0;
	for (long long i = 0; i < m; i++) {
		if (dp[i] == MINT) {
			continue;
		}
		for (int j = 0; j < n; j++) {
			for (int q = 0; q < w[i].size(); q++) {
				if (q + i > m) {
					break;
				}
				if (s[q + i] != w[j][q]) {
					break;
				}
				dp[q + i + 1] = min2(dp[q + i + 1], dp[i] + c[j]);
			}
		}
	}
	if (dp[m] == MINT) {
		cout << "-1";
	} else {
		cout << dp[m];
	}
	return 0;
}