#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <string>
#include <set>
#include <string>
#include <vector>
#define ll long long
using namespace std;

const int MAXN = 1e5 + 111;
const ll INF = 1e18;

int n, m, l;

ll dp[MAXN];

int c[MAXN];

bool was[MAXN];

string ss, s[MAXN];

bool can(int l, int r, int id, int l2, int r2)
{
	int dd = 0;
	while (l + dd < n && l2 + dd < r2)
	{
		if (ss[l + dd] != s[id][l2 + dd])
			return false;
		dd++;
	}
	return true;
}

ll solve(int id)
{
	if (id >= n)
		return 0;
	if (was[id])
		return dp[id];
	was[id] = true;
	ll ans = INF;
	for (int i = 0; i < m; i++)
	{
		int dd = 1;
		while (dd <= s[i].size() && can(id, id + dd, i, 0, dd))
		{
			ans = min(ans, solve(id + dd) + c[i]);
			dd++;
		}
		dd = s[i].size() - 1;
		int len = 1;
		while (dd >= 0 && can(id, id + len, i, dd, s[i].size()))
		{
			ans = min(ans, solve(id + len) + c[i]);
			dd--;
			len++;
		}
	}
	return dp[id] = ans;
}

int main()
{
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	cin >> n >> m >> l;
	cin >> ss;
	for (int i = 0; i < m; i++)
	{
		cin >> c[i];
		cin >> s[i];
	}
	ll ans = solve(0);
	if (ans == INF)
		printf("-1");
	else
		printf("%lld", ans);
	return 0;
}