#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>

using namespace std;

const long long maxn = 2000;
const long long inf = (int) 1e8;

long long n, m, L, len;
string s;
pair <long long, string> v[maxn];
long long d[maxn];

bool sovp(long long pos, long long it, long long st, long long f) {
	while (true) {
		if (pos > len) {
			return false;
		}

		if (st == f) {
			return true;
		}

		if (s[pos] == v[it].second[st]) {
			pos++;
			st++;
		} else {
			return false;
		}
	}
}

long long go(long long pos) {
	if (pos == len) {
		d[pos] = 0;
	} else if (d[pos] == -1) {
		d[pos] = inf;

		for (long long i = 0; i < m; i++) {
			for (long long j = 0; j < (long long)v[i].second.size(); j++) {
				if (sovp(pos, i, 0, j + 1)) {
					d[pos] = min(d[pos], go(pos + j + 1) + v[i].first);
				}
			}
		}

		for (long long i = 0; i < m; i++) {
			for (long long j = 0; j < (long long)v[i].second.size(); j++) {
				long long len = v[i].second.size();
				if (sovp(pos, i, j, len)) {
					d[pos] = min(d[pos], go(pos + len - j) + v[i].first);
				}
			}
		}
	}

	return d[pos];
}

int main() {
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);

	scanf("%lld %lld %lld", &n, &m, &L);
	cin >> s;

	len = s.size();

	for (long long i = 0; i < m; i++) {
		long long c;
		string h;
		scanf("%lld", &c);
		cin >> h;

		v[i] = make_pair(c, h);
	}

	for (long long i = 0; i < maxn; i++) {
		d[i] = -1;
	}

	if (go(0) >= inf) {
		cout << "-1";
	} else {
		cout << go(0);
	}

	return 0;
}
/*
9 2 8
000110100
1 100
1 11001
*/