#include <fstream>
#include <vector>
#include <cmath>
#include <set>
#include <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 long long ll;

map<string, int> list;
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;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> m >> L;
	cin >> s;
	rep(k, 0, m) {
		int w;
		string c;
		cin >> w >> c;
		string t = c;
		list[c] = (list[c] == 0 ? w : min(list[c], w));

		rep(k, 0, c.length() - 1) {
			t.erase(t.begin());
			list[t] = (list[t] == 0 ? w : min(list[t], w));
		}
		t = c;
		rep(i, 0, c.length() - 1) {
			t.erase(t.begin() + t.length() - 1);
			list[t] = (list[t] == 0 ? w : min(list[t], w));
		}
	}
	vec<int> dp(n + 1, -1);
	dp[0] = 0;
	rep(k, 1, n + 1) {
		for (map<string, int>::iterator it = list.begin(); it != list.end(); it++) {
			string t = (*it).first;
			int w = (*it).second;
			if (k >= t.length() && copy(k - t.length(), k - 1) == t) {
				int sum = w + dp[k - t.length()];
				dp[k] = (dp[k] == -1 ? sum : min(dp[k], sum));
			}
		}
	}
	cout << dp[n];
	return 0;
}
