#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <string>
#include <set>
#include <string>
#include <vector>
#pragma comment(linker, "/STACK:256000000")
#define ll long long
using namespace std;

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

int n, m, l;

ll dp[MAXN];

int c[MAXN];

bool was[MAXN];

int pw[MAXN];

int hh[MAXN];

vector <vector <int> > h;

string ss, s[MAXN];

void init()
{
	pw[0] = 1;
	for (int i = 1; i < MAXN; i++)
		pw[i] = ((ll)pw[i - 1] * 239017) % MOD;
	hh[0] = ss[0];
	for (int i = 1; i < n; i++)
		hh[i] = ((ll)hh[i - 1] * pw[1] + ss[i]) % MOD;
	h.resize(m);
	for (int i = 0; i < m; i++)
	{
		h[i].push_back(s[i][0]);
		for (int j = 1; j < s[i].size(); j++)
			h[i].push_back(((ll)h[i][j - 1] * pw[1] + s[i][j]) % MOD);
	}
}

bool can(int l, int r, int id, int l2, int r2)
{
	if (r > n)
		return false;
	r--, r2--;
	int h1, h2;
	if (l > 0)
		h1 = (hh[r] + MOD - ((ll)hh[l - 1] * pw[r - l + 1]) % MOD) % MOD;
	else
		h1 = hh[r];
	if (l2 > 0)
		h2 = (h[id][r2] + MOD - ((ll)h[id][l2 - 1] * pw[r2 - l2 + 1]) % MOD) % MOD;
	else
		h2 = h[id][r2];
	return h1 == h2;
}

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 (id + dd <= n && 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 (id + len <= n && dd >= 0)
		{
			if (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];
	}
	init();
	ll ans = solve(0);
	if (ans == INF)
		printf("-1");
	else
		printf("%lld", ans);
	return 0;
}