#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cassert>
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <deque>
#include <vector>

#define mp  make_pair

using namespace std;

typedef long long int   ll;
typedef long double     ld;
typedef pair<int, int>    ii;
typedef vector<int>       vi;
typedef vector<ii>        vii;

const int MAXN = 200000;
const int INF = 1000000010;

int M, N, L;
char s[MAXN], t[MAXN], str[MAXN];
int z_func[MAXN];
int ci, li;
ll ans[MAXN] = { 0 };
vii g[MAXN];

void calc_z(bool reversed = false) {
	int len = strlen(str);
	int lb = 0, rb = 1;

	z_func[0] = 0;
	for (int i = 1; i < len; i++) {
		if (i >= rb) {
			z_func[i] = 0;
		}
		else {
			z_func[i] = z_func[i - lb];
			if (i + z_func[i] > rb)
				z_func[i] = rb - i;
		}

		while (i + z_func[i] < len && str[i + z_func[i]] == str[z_func[i]]) {
			z_func[i]++;
		}

		if (rb < i + z_func[i]) {
			rb = i + z_func[i];
			lb = i;
		}

		if (i > li) {
			for (int j = i + z_func[i] - 1; j >= i; j--) {
				if (!reversed) {
					g[j - li - 1].push_back(mp(i - li - 2, ci));
				}
				else {
					g[M - (i - li - 1) - 1].push_back(mp(M - (j - li - 1) - 2, ci));
				}
			}
		}
	}
}

inline ll get_ans_from(int pi, int ci) {
	if (pi < 0)
		return ci;
	return ans[pi] + ci;
}

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

	scanf("%d %d %d", &M, &N, &L);

	assert(M <= 50000 && L <= 50000);

	scanf("%s", s);
	for (int i = 0; i < N; i++) {
		scanf("%d %s", &ci, t);
		li = strlen(t);

		str[0] = 0;
		strcat(str, t);
		strcat(str + li, "#");
		strcat(str + li + 1, s);

		calc_z();

		reverse(str, str + li);
		reverse(str + li + 1, str + li + 1 + M);

		calc_z(true);
	}

	for (int i = 0; i < M; i++) {
		for (auto it = g[i].begin(); it != g[i].end(); it++) {
			if (it->first < 0 || ans[it->first]) {
				if (!ans[i]) {
					ans[i] = get_ans_from(it->first, it->second);
				}
				else {
					ans[i] = min(ans[i], get_ans_from(it->first, it->second));
				}
			}
		}
	}

	if (!ans[M - 1])
		puts("-1");
	else
		printf("%lld", ans[M - 1]);

	return 0;
}