//#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int l,n, k, a, b, i, c, j, ii, z, a1;
char ch;
bool u;
char m2[400000];
long long dp[400000];
const long long md = 1000000007;
const long long osn = 37;
vector <pair<int, int> > m3[400000];
long long t[400000];
long long has[400000];
string s1;
pair<int, int> ttt;
long long m5[200000][2], m6[200000][2], m8[200000], m7[200000];
struct cmp
{
	bool operator()(const pair<int, int> & a, const pair<int, int> & b) const
	{
		return (a.first < b.first);
	}
};
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	scanf("%d%d%d\n", &k, &n, &l);
	scanf("%s", &m2);
	string s = "5";
	s = s + m2;
	t[0] = 1;
	for (int i = 1; i <= max(l,k); i++)
		t[i] = (t[i - 1] * osn) % md;
	int kol = 0,kol1=0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%s", &b, &m2);
		s1 = "5";
		s1 = s1+ m2;
		a = 0;
		for (int z = 1; z < s1.length(); z++)
		{
			if (m5[a][s1[z]] == 0)
			{
				kol++;
				m5[a][s1[z]] = kol;
			}
			a = kol;
			if (m7[a] == 0)
				m7[a] = b;
			else
				m7[a] = min(m7[a], (long long)b);
		}
		a = 0;
		for (int z = s1.length() - 1; z >= 1; z--)
		{
			if (m6[a][s1[z]] == 0)
			{
				kol1++;
				m6[a][s1[z]] = kol1;
			}
			a = kol1;
			if (m8[a] == 0)
				m8[a] = b;
			else
				m8[a] = min(m8[a], (long long)b);
		}
	}
	dp[0] = 0;
	for (int i = 1; i <= k; i++)
	{
		dp[i] = -1;
		a = 0;
		for (int z = i; z >= max(1,i - 2000); z++)
		{
			if (m5[a][s[z]] != 0)
				a = m5[a][s[z]];
			if (dp[z - 1] == -1)
				continue;
			if (dp[i] == -1)
				dp[i] = dp[z - 1] + m7[a];
			else
				dp[i] = min(dp[i], dp[z - 1] + m7[a]);
		}
		a = 0;
		if (dp[i - 1] == -1)
			continue;
		for (int z = i; z <= min(k, i + 2001); z++)
		{
			if (m6[a][s[z]] != 0)
				a = m6[a][s[z]];
			if (dp[z] == -1)
				dp[z] = dp[i - 1] + m8[a];
			else
				dp[z] = min(dp[z], dp[i - 1] + m8[a]);
		}
	}
	printf("%I64d", dp[k]);
	return 0;
}