#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <unordered_map>
#include <algorithm>

using namespace std;

int n, m, l;
string s;
unordered_map <string, int> ch;
long long dp[1000000];

int main()
{
    ios_base::sync_with_stdio(false);
    freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> m >> n >> l;
    cin >> s;
    for (int i = 1; i <= n; i++)
    {
        string s1;
        int c;
        cin >> c >> s1;

        string s2 = "";
        for (int g = 0; g < s1.length(); g++)
        {
            s2 += s1[g];
            if (ch[s2] == 0)
            {
                ch[s2] = c;
            } else
            {
                ch[s2] = min(ch[s2], c);
            }
        }

        s2 = "";

        for (int g = int(s1.length()) - 1; g >= 0; g--)
        {
            s2 = s1[g] + s2;
            if (ch[s2] == 0)
            {
                ch[s2] = c;
            } else
            {
                ch[s2] = min(ch[s2], c);
            }
        }
    }

    for (int i = 0; i < s.length(); i++)
    {
        dp[i] = 1e18;

        string s1 = "";
        for (int g = i; g >= 0; g--)
        {
            s1 = s[g] + s1;

            if (ch[s1] != 0)
            {
                if (g == 0)
                {
                    dp[i] = min((long long)ch[s1], dp[i]);
                } else
                if (dp[g - 1] < 1e18)
                {
                    dp[i] = min(dp[i], dp[g - 1] + ch[s1]);
                }
            }
        }
    }

    if (dp[int(s.length()) - 1] >= 1e18)
    {
        cout << -1 << endl;
    } else
    {
        cout << dp[int(s.length()) - 1] << endl;
    }
    return 0;
}
