#include<fstream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

const int maxn = 5005;
const long long inf = 100000000000000009;

int m, n, l;
pair<int, string> arr[maxn];
string st;
long long mur[5005];

vector<vector<vector<long long> > > dp[5005];
vector<vector<long long> > v1;
vector<long long> v2;

int main() {
	ifstream cin("typing.in");
	ofstream cout("typing.out");
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> m >> n >> l;
	st.assign("#", m + 1);
	cin >> st;
	st = "#" + st;
	for (int i = 1; i <= n; ++i) {
		cin >> arr[i].first >> arr[i].second;
	}
	for (int i = 0; i <= m; ++i) {
		dp[i].assign(n + 2, v1);
		for (int j = 1; j <= n; ++j) {
			dp[i][j].assign(arr[j].second.length() + 2, v2);
		}
	}
	long long mn = inf;
	for (int j = 1; j <= n; ++j) {
		dp[0][j][0].assign(2, 0);
		dp[0][j][0][0] = dp[0][j][0][1] = arr[j].first;
	}
	for (int i = 1; i <= m; ++i) {
		mn = inf;
		for (int j = 1; j <= n; ++j) {
			for (int k = 1; k <= min((int)arr[j].second.length(), i); ++k) {
				dp[i][j][k].assign(2, 0);
				if (st[i] == arr[j].second[k - 1] && dp[i - 1][j][k - 1][0] < inf)
					dp[i][j][k][0] = dp[i - 1][j][k - 1][0], mn = min(dp[i][j][k][0], mn);
				else
					dp[i][j][k][0] = inf;
			}
			
		}
		for (int j = 1; j <= n; ++j) {
			for (int k = 1; k <= min((int)arr[j].second.length(), i); ++k) {
				if (st.substr(i - k + 1, k) == arr[j].second.substr(arr[j].second.length() - k, k))
					dp[i][j][k][1] = mur[i-k]+arr[j].first, mn = min(dp[i][j][k][1], mn);
				else
					dp[i][j][k][1] = inf;
			}

		}
		for (int j = 1; j <= n; ++j)
			dp[i][j][0].assign(2,0), dp[i][j][0][0] = mn + arr[j].first;
		mur[i] = mn;
	}
	if (mn >= inf) cout << -1;
	else cout << mn;
	return 0;
}