#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cassert>

using namespace std;

typedef long long ll;

#define TASK "typing"
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define for1(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define pk push_back
#define mk make_pair

const int MAXN = (int)3000 + 7;
const ll LINF = (ll)2e18;

int solve();

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

ll c[MAXN], dp[MAXN];
string str[MAXN], revstr[MAXN];

int solve() {
	int m, n, l;
	cin >> m >> n >> l;
	string s;
	cin >> s;
	s = '#' + s;
	forn(i, n) {
		cin >> c[i] >> str[i];
		revstr[i] = str[i];
		reverse(all(revstr[i]));
	}

	for1(i, m) {
		dp[i] = LINF;
	}

	for1(i, m) {
		string cur;
		ll nd = LINF;
		for (int j = i, len = 1; j >= 1; j--, len++) {//suf
			cur += s[j];
			ll suffcost = LINF;
			forn(w, n) {
				if (revstr[w].substr(0, len) == cur) {
					suffcost = min(suffcost, c[w]);
				}
			}

			nd = min(nd, dp[j - 1] + suffcost);
		}

		cur.clear();
		for (int j = i, len = 1; j <= m; j++, len++) {//pref
			cur += s[j];
			ll prefcost = LINF;
			forn(w, n) {
				if (str[w].substr(0, len) == cur) {
					prefcost = min(prefcost, c[w]);
				}
			}

			dp[j] = min(dp[j], dp[i - 1] + prefcost);
		}

		dp[i] = min(dp[i], nd);
	}

	cout << (dp[m] >= LINF ? -1 : dp[m]);
	return 0;
}