#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <vector>
#include <string>
#include <cassert>
#include <utility>
#include <stack>
#include <set>
#include <map>
#include <functional>

#define ll long long
#define ld long double
#define mp make_pair
#define TASKNAME "typing"

using namespace std;

const int inf = 1e9;

map<string, int> mm;

int ans = inf;

void go(const string& s, int pos, int cost) {
	if (pos == s.size()) {
		ans = min(ans, cost);
	}
	for (auto it = mm.rbegin(); it != mm.rend(); it++) {
		string t = it->first;
		int c = it->second;
		if (s.substr(pos, t.size()) == t) {
			go(s, pos + t.size(), cost + c);
			break;
		}
	}
}

void solve() {
	int m, n, l;
	cin >> m >> n >> l;
	string s;
	cin >> s;
	for (int i = 0; i < n; i++) {
		int c;
		string s1, s2;
		cin >> c >> s1;
		s2 = string(s1.rbegin(), s1.rend());
		for (int j = 1; j <= s1.size(); j++) {
			string cur = "";
			cur = s1.substr(0, j);
			if (mm.find(cur) == mm.end())
				mm[cur] = c;
			else mm[cur] = min(c, mm[cur]);
			cur = s2.substr(0, j);
			if (mm.find(cur) == mm.end())
				mm[cur] = c;
			else mm[cur] = min(c, mm[cur]);
		}
	}
	go(s, 0, 0);
	cout << (ans == inf ? -1 : ans);
}

int main() {
#ifdef __DEBUG__
	freopen("input.txt", "r", stdin);
	clock_t start = clock();
#else
	freopen(TASKNAME".in", "r", stdin);
	freopen(TASKNAME".out", "w", stdout);
#endif
	srand(time(NULL));

	solve();

#ifdef __DEBUG__
	cerr << "\nTime: " << (ld)(clock() - start) / (ld)CLOCKS_PER_SEC << endl;
#endif
	return 0;
}