
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#pragma comment (linker, "/STACK:100000000")

using namespace std;

int main()
{
	freopen( "typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);

	int len = 0, n = 0, L = 0;
	cin >> len >> n >> L;

	string str;
	cin >> str;

	vector <string>    strs (2 * n);
	vector <long long> cost (2 * n);

	for (int i = 0; i < n; i++)
	{
		string new_str;
		int n_cost = 0;
		cin >> n_cost >> new_str;

		string rev = new_str;
		reverse(rev.begin(), rev.end());

		strs[2 * i + 0] = new_str;
		strs[2 * i + 1] = rev;

		cost[2 * i] = cost[2 * i + 1] = n_cost;
	}

	vector <long long> d(len, -1);

	for (int i = 0; i < len; i++)
	{
		for (int word = 0; word < 2 * n; word++)
		{
			for (int suf = 0; suf <= i; suf++)
			{
				if (suf >= strs[word].size())
					break;

				if (strs[word][suf] == str[i - suf])
				{
					if (i == suf)
					{
						long long new_ans = cost[word];

						if (d[i] == -1 || new_ans < d[i])
							d[i] = new_ans;
					}
					else
					{
						long long new_ans = d[i - suf - 1] + cost[word];

						if (d[i] == -1 || new_ans < d[i])
							d[i] = new_ans;
					}
				}
				else
					break;
			}
		}
	}

	cout << d.back();
	return 0;
}