#include <fstream>
#include <vector>
#include <cmath>
#include <set>
#include <unordered_map>
#include <cstdlib>
#include <ctime>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

ifstream cin("typing.in");
ofstream cout("typing.out");

#define vec vector
#define pb push_back
#define rep(k, l, r) for (int k = (int)(l); k < (int)(r); k++)
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef long long ll;

unordered_map<string, int> use;
vec<PSI> possib;
int n, m, L;

string s;

string copy(int l, int r) {
	string res = "";
	rep(k, l, r + 1) { res = res + s[k]; }
	return res;
}

bool comp(const PSI a, const PSI b) {
	if (a.first.length() != b.first.length()) {
		return a.first.length() < b.first.length();
	}
	return a.second < b.second;
}

int main() {
	string c, t;
	int w;
	ios_base::sync_with_stdio(false);
	cin >> n >> m >> L;
	cin >> s;
	rep(k, 0, m) {
		cin >> w >> c;
		
		t = "";
		for (int k = c.length() - 1; k >= 0 && (int)t.length() < n; k--) {
			t = c[k] + t;
			use[t] = (use[t] == 0 ? w : min(use[t], w));
		}
		t = "";
		rep(k, 0, c.length()) {
			t = t + c[k];
			if ((int)t.length() > n) { break; }
			use[t] = (use[t] == 0 ? w : min(use[t], w));
		}
	}
	/*if (s == "000110100") { cout << 4; return 0; }
	cout << "ready";
	return 0;*/
	for (unordered_map<string, int>::iterator it = use.begin(); it != use.end(); it++) {
		possib.push_back(PSI((*it).first, (*it).second));
	}
	sort(possib.begin(), possib.end(), comp);
	vec<ll> dp(n + 1, -1);
	dp[0] = 0;
	rep(k, 1, n + 1) {
		string cmp = "";
		cmp = s[k - 1] + cmp;
		rep(i, 0, possib.size()) {
			string t = possib[i].first;
			int w = possib[i].second;
			if (k < (int)t.length()) {
				break;
			}
			if (t.length() > cmp.length()) { cmp = s[k - t.length()] + cmp; }
			if (cmp == t) {
				ll sum = w + dp[k - t.length()];
				dp[k] = (dp[k] == -1 ? sum : min(dp[k], sum));
			}
		}
	}
	cout << dp[n];
	return 0;
}
