#include <fstream>
#include <unordered_map>
#include <string>
#include <algorithm>

#define MAXN (int)5e5

using namespace std;

unordered_map<string, int> arr;

string s;
int dp[MAXN];

int main()
{
	ifstream fin("typing.in");
	ofstream fout("typing.out");
	int m, n, L;
	fin >> m >> n >> L;
	fin >> s;
	for (int i = 0; i < n; i++)
	{
		int pr;
		string stt;
		fin >> pr >> stt;
		int asdf = min(stt.size(), s.size());
		for (int i = 0; i < asdf; i++)
		{
			string su = stt.substr(i, asdf - i);
			if (arr[su] == 0)
				arr[su] = pr;
			arr[su] = min(arr[su], pr);
			su = stt.substr(0, i + 1);
			if (arr[su] == 0)
				arr[su] = pr;
			arr[su] = min(arr[su], pr);
		}
	}
	for (int i = 0; i < s.size(); i++)
		for (auto it : arr)
			if (s.substr(i, s.length() - i).find(it.first) == 0)
				if (dp[i + it.first.length()] == 0 || dp[i + it.first.length()] > dp[i] + it.second)
					dp[i + it.first.length()] = dp[i] + it.second;
	if (dp[s.length()] == 0)
		fout << -1;
	else
		fout << dp[s.length()];
	return 0;
}
