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

using namespace std;

vector<string> q;
vector<int> c;

int d[100];

int main()
{
	freopen("typing.in", "r", stdin);
	freopen("typing.out", "w", stdout);
	int n, m, l;
	cin >> m >> n >> l;
	string s;
	cin >> s;
	for (int i = 0; i < n; i++)
	{
		int t;
		string s;
		cin >> t >> s;
		q.push_back(s);
		c.push_back(t);
	}
	for (int i = 0; i <= m; i++)
	{
		d[i] = 1e9;
	}
	d[0] = 0;
	for (int i = 0; i < m; i++)
	{
		for (int j = 0; j < (int)q.size(); j++)
		{
			for (int k = 0; k < min(m - i, (int)q[j].size()); k++)
			{
				if (s[i + k] != q[j][k])
					break;
				d[i + k + 1] = min(d[i + k + 1], d[i] + c[j]);
			}
			for (int k = 0; k < min(m - i, (int)q[j].size()); k++)
			{
				bool flag = false;
				for (int ss = 0; ss <= k; ss++)
				{
					if (s[i + ss] != q[j][q[j].size() - k - 1 + ss])
					{
						flag = true;
						break;
					}
				}
				if (flag)
					break;
				d[i + k + 1] = min(d[i + k + 1], d[i] + c[j]);
			}
		}
	}
	if (d[m] >= 1e5)
		cout << -1 << endl;
	else
		cout << d[m] << endl;
}



