#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <cassert>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>

using namespace std;

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define forq(i, q, n) for (int i = int(q); i < int(n); ++i)
#define all(v) v.begin(), v.end()
#define mk make_pair
#define psh push_back
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define X first
#define Y second
#define TASK "typing"

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;

const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const int MAXN = 5 * (int)1e3 + 7;
const double EPS = 1e-6;

void file() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
	freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
#endif
}

int main() {
	file();
	int n, m, L;
	scanf("%d%d%d", &n, &m, &L);
	unordered_map <string, int> A, B;
	int c;
	string h;
	string ss;
	getline(cin, ss);
	getline(cin, ss);
	unordered_set <string> ddd;
	string t;
	ddd.insert("");
	forn(i, n) {
		t = "";
		forq(j, i, n) {
			t += ss[j];
			ddd.insert(t);
		}
	}
	forn(i, m) {
		scanf("%d ", &c);
		getline(cin, h);
		string j = "";
		forn(i, h.size()) {
			j += h[i];
			if (j.size() > n || ddd.find(j) == ddd.end()) {
				break;
			}
			if (B.find(j) == B.end()) {
				B[j] = c;
			}
			else {
				B[j] = min(B[j], c);
			}
		}
		j = "";
		forn(i, h.size()) {
			j = h[h.size() - i - 1] + j;
			if (j.size() > n) {
				break;
			}
			if (B.find(j) == B.end()) {
				B[j] = c;
			}
			else {
				B[j] = min(B[j], c);
			}
		}
	}
	set <pair <pii, string> > sss;
	sss.insert(mk(mk(0, 0), ""));
	A[""] = 0;
	while (!sss.empty()) {
		string j = (*sss.begin()).Y;
		int k = (*sss.begin()).X.Y;
		sss.erase(sss.begin());
		if (k > A[j] || ddd.find(j) == ddd.end()) {
			continue;
		}
		for (auto it = B.begin(); it != B.end(); it++) {
			if ((it->X).size() + j.size() > n) {
				continue;
			}
			if ((it->X).size() + j.size() == n && (it->X + j == ss || j + it->X == ss)) {
				if (A.find(it->X + j) != A.end()) {
					A[it->X + j] = min(A[it->X + j], A[j] + it->Y);
				}
				else {
					A[it->X + j] = A[j] + it->Y;
				}
				if (A.find(j + it->X) != A.end()) {
					A[j + it->X] = min(A[j + it->X], A[j] + it->Y);
				}
				else {
					A[j + it->X] = A[j] + it->Y;
				}
				continue;
			}
			if (ddd.find(it->X + j) != ddd.end()) {
				if (A.find(it->X + j) != A.end()) {
					A[it->X + j] = min(A[it->X + j], A[j] + it->Y);
				}
				else {
					A[it->X + j] = A[j] + it->Y;
				}
				sss.insert(mk(mk((it->X).size() + j.size(), A[it->X + j]), it->X + j));
			}
			if (ddd.find(j + it->X) != ddd.end()) {
				if (A.find(j + it->X) != A.end()) {
					A[j + it->X] = min(A[j + it->X], A[j] + it->Y);
				}
				else {
					A[j + it->X] = A[j] + it->Y;
				}
				sss.insert(mk(mk((it->X).size() + j.size(), A[j + it->X]), j + it->X));
			}
		}
	}
	if (A.find(ss) == A.end()) {
		puts("-1");
	}
	else {
		printf("%d", A[ss]);
	}
	return 0;
}