#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;

const int SIZE = 300000;
const int INF = 1e9 + 7;

char s[SIZE], t[SIZE];
unordered_map<string, int> cost;
int dp[SIZE];

int main()
{
#ifdef _CONSOLE
	freopen("input.txt", "r", stdin);
#else
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
#endif

	int n, m, L;

	scanf("%d %d %d\n", &n, &m, &L);

	gets_s(s);

	for (int j = 0; j < m; j++) {
		int c;

		scanf("%d %s", &c, t);

		for (int i = 0; s[i]; i++) {
			string tmp1(t, t + i + 1);

			if (cost[tmp1] == 0 || cost[tmp1] > c)
				cost[tmp1] = c;

			string tmp2(t + i);

			if (cost[tmp2] == 0 || cost[tmp2] > c)
				cost[tmp2] = c;
		}
	}

	dp[n] = 0;
	for (int i = n - 1; i >= 0; --i) {
		dp[i] = INF;

		for (int j = i; s[j]; j++) {
			int t = cost[string(s + i, s + j + 1)];

			if (t > 0 && t + dp[j + 1] < dp[i])
				dp[i] = t + dp[j + 1];
		}
	}

	if (dp[0] != INF)
		printf("%d\n", dp[0]);
	else
		printf("-1\n");
}