#include <fstream>
#include <bitset>
#include <string>

using namespace std;

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

const int MAXN = 57;
const int INF = 1e9;

int d[MAXN];
string s;
string word[MAXN];
int weight[MAXN];

int main() {
	int n, m, L;
	cin >> n >> m >> L >> s;
	for (int i = 0; i < m; ++i) {
		cin >> weight[i] >> word[i];
	}
	for (int i = 0; i <= n; ++i) {
		d[i] = INF;
	}
	d[0] = 0;
	for (int j = 0; j <= n; ++j) {
		for (int k = 0; k < m; ++k) {
			for (int i = max(0, j - (int)word[k].size()); i < j; ++i) {
				if (s.substr(i, j - i) == word[k].substr(0, j - i)
				 || s.substr(i, j - i) == word[k].substr(word[k].size() - j + i, j - i))
					d[j] = min(d[j], d[i] + weight[k]);
			}
		}
	}
	// for (int i = 0; i <= n; ++i) {
	// 	cout << d[i] << ' ';
	// }
	// cout << '\n';
	cout << (d[n] == INF ? -1 : d[n]) << '\n';
}