#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];
char revs[MAXN];
vector<ii> g[MAXN];
ll ans[MAXN] = { 0 };

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);

	scanf("%s", s);

	revs[0] = 0;
	strcpy(revs, s);
	reverse(revs, revs + M);

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

		li = strlen(t);
		for (int j = 0; j < M; j++) {
			len = 0;

			while (len < min(M - j + 1, li) && t[len] == s[j + len])
				len++;

			for (int l = j + len - 1; l >= j; l--)
				g[l].push_back(mp(j - 1, ci));
		}

		reverse(t, t + li);
		for (int j = 0; j < M; j++) {
			len = 0;
			while (len < min(M - j + 1, li) && t[len] == revs[j + len])
				len++;

			for (int l = j + len - 1; l >= j; l--)
				g[M - j - 1].push_back(mp(M - l - 2, ci));
		}
	}

	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] = (it->first >= 0 ? ans[it->first] : 0) + it->second;
				}
				else {
					ans[i] = min(ans[i], (ll)(it->first >= 0 ? ans[it->first] : 0) + it->second);
				}
			}
		}
	}

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

	return 0;
}