#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <algorithm>
#include <cassert>
#include <ctime>

using namespace std;

#define int long long

vector<vector<long long> > hsh;

const long long POW = 229;
const long long MOD = 1000000007;
const long long l_inf = 1000000000000000;

vector<long long> p;

void build_hash(string s, int ind) {
	hsh[ind].resize(s.size() + 1);
	for (int i = 1; i < s.size() + 1; i++) {
		hsh[ind][i] = (hsh[ind][i - 1] + s[i - 1] * p[i]) % MOD;
	}
}

bool comp_hashes(int i1, int x1, int y1, int i2, int x2, int y2) {
	long long val1 = (hsh[i1][y1 + 1] - hsh[i1][x1] + MOD) % MOD;
	long long val2 = (hsh[i2][y2 + 1] - hsh[i2][x2] + MOD) % MOD;
	return (val1 * p[y2]) % MOD == (val2 * p[y1]) % MOD;
}

signed main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	int n, m, l;
	string s;
	cin >> m >> n >> l;
	cin >> s;
	hsh.resize(n + 1);
	p.resize(300001);
	vector<int> cost(n);
	p[0] = 1;
	for (int i = 1; i < 300001; i++) {
		p[i] = (p[i - 1] * POW) % MOD;
	}
	build_hash(s, n);
	for (int i = 0; i < n; i++) {
		long long cst;
		string cs;
		cin >> cst >> cs;
		build_hash(cs, i);
		cost[i] = cst;
	}
	vector<long long> dp(s.size() + 1, l_inf);
	dp[0] = 0;
	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < n; j++) {
			for (int c = 1; c < min((long long)hsh[j].size(), s.size() - i + 1); c++) {
				if (comp_hashes(n, i, i + c - 1, j, 0, c - 1))
					dp[i + c] = min(dp[i + c], dp[i] + cost[j]);
				if (comp_hashes(n, i, i + c - 1, j, hsh[j].size() - c - 1, hsh[j].size() - 2))
					dp[i + c] = min(dp[i + c], dp[i] + cost[j]);
			}
		}
	}
	if (dp[s.size()] == l_inf)
		cout << -1 << endl;
	else
		cout << dp[s.size()] << endl;
	return 0;
}

