#pragma comment(linker, "/Stack:512000000")
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long LL;
typedef double dbl;

const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const dbl EPS = 1e-9;

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#elif 1
# define PROB "typing"
  freopen(PROB".in", "r", stdin);
  freopen(PROB".out", "w", stdout);
#endif
  cin.tie(0);
  cin.sync_with_stdio(0);

  int m, n, L;
  cin >> m >> n >> L;

  string s;
  cin >> s;

  vector<pair<int, string>> t(n);
  for (int i = 0; i < n; ++i) {
    cin >> t[i].first >> t[i].second;
  }

  s = '#' + s;

  vector<LL> dp(m + 1, INF * 1ll * INF);

  dp[0] = 0;

  for (int i = 1; i <= m; ++i) {
    for (int j = 0; j < n; ++j) {
      int tmp = 0;
      while (i - tmp > 0 && int(t[j].second.length()) - 1 - tmp > -1 && s[i - tmp] == t[j].second[t[j].second.length() - 1 - tmp]) {
        dp[i] = min(dp[i], dp[i - tmp - 1] + t[j].first);
        tmp++;
      }

      tmp = 0;
      while (i + tmp < s.length() && tmp < t[j].second.length() && s[i + tmp] == t[j].second[tmp]) {
        dp[i + tmp] = min(dp[i + tmp], dp[i - 1] + t[j].first);
        tmp++;
      }
    }
  }

  if (dp[m] == INF * 1ll * INF)
    cout << -1 << endl;
  else
    cout << dp[m];

  return 0;
}