#include<iostream>
#include<fstream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

#define all(x) x.begin(), x.end()
#define ll long long

map<string, ll> cost;
ll dp[100001];

int main() {
	ios_base::sync_with_stdio(0);
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	int n, m, L;
	cin >> n >> m >> L;
	string s;
	cin >> s;
	for (int i = 0; i < m; i++) {
		string h;
		ll c;
		string now;
		cin >> c >> now;
		for (int i = 0; i < n && i < now.size(); i++) {
			h += now[i];
		//	cout << h << "\n";
			if (cost[h] == 0)
				cost[h] = c;
			else
				cost[h] = min(cost[h], c);
		}
		h.clear();
		for (int i = now.size() - 1; i >= 0 && i >= ((ll)now.size() - n); i--) {
			h = now[i] + h;
			//cout << h << "\n";
			if (cost[h] == 0)
				cost[h] = c;
			else
				cost[h] = min(cost[h], c);
		}
	}
	dp[0] = 1e18 + 1;
	string p;
	for (int i = 0; i < n; i++) {
		p += s[i];
		dp[i + 1] = 1e18 + 1;
		if (cost[p] > 0)
			dp[i + 1] = min(cost[p], dp[i + 1]);
		string h;
		for (int j = i; j >= 0; j--) {
			h = s[j] + h;
			if (cost[h] > 0) {
				dp[i + 1] = min(dp[i + 1], dp[j] + cost[h]);
			}
		}
	}
	//for (int i = 1; i < n; i++)
	if (dp[n] == 1e18 + 1)
		cout << -1;
	else
		cout << dp[n];
}