#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstdlib>

#define ll long long
#define ld long double
#define mp make_pair
#define sz(x) (int) x.size()

using namespace std;

#define TASKNAME "typing"

const int N = 3e5;
const ll LINF = 1e18;

int m, n, L;
int a[N];
string words[N];
ll dp[N];
ll cost[N];

int main() {
	ios::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#else
	if (TASKNAME != "") {
		freopen(TASKNAME ".in", "r", stdin);
		freopen(TASKNAME ".out", "w", stdout);
	}
#endif

	cin >> m >> n >> L;

	string s;
	cin >> s;

	for (int i = 0; i < n; i++) {
		cin >> cost[i];
		cin >> words[i];
	}

	fill(dp, dp + N, LINF);
	dp[0] = 0;

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < sz(words[j]) && i + k < m; k++) {
				if (s[i + k] != words[j][k]) {
					break;
				}

				dp[i + k + 1] = min(dp[i + k + 1], dp[i] + cost[j]);
			}

			for (int k = 0; k < sz(words[j]); k++) {
				int len = sz(words[j]) - k;
				if (i + len - 1 >= m) continue;
				if (s.substr(i, len) == words[j].substr(k, len)) {
					dp[i + len] = min(dp[i + len], dp[i] + cost[j]);
				}
			}
		}
	}

	cout << (dp[m] == LINF ? -1 : dp[m]) << endl;

#ifdef _DEBUG
	while (1);
#endif

	return 0;
}