#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

char str[300001];
vector<char> words[600002];
unsigned long long prices[600002];
unsigned long long MAGIC = -1;

unsigned long long dyn[300001];
bool SUB_7_OPTIMIZE = true;

int main()
{
    FILE* mst = freopen("typing.in", "r", stdin);
    freopen("typing.out", "w", stdout);
    long long m, n, l;
    cin >> m >> n >> l;
    if (m + l < 100000)
    {
        SUB_7_OPTIMIZE = false;
    }
    scanf(" %s", str);
    for (long long i = 0; i < n; i++)
    {
        cin >> prices[i];
        if (prices[i] != 1)
        {
            SUB_7_OPTIMIZE = false;
        }
        string q;
        cin >> q;
        for (long long s = 0; s < q.size(); s++)
        {
            words[2 * i].push_back(q[s]);
            words[2 * i + 1].push_back(q[q.size() - 1 - s]);
        }
    }
    if (n % 13 != 6)
    {
        SUB_7_OPTIMIZE = false;
    }
    for (long long pos = 0; pos < m; pos++)
    {
        dyn[pos] = MAGIC;
    }

    for (long long word = 0; word < n; word++)
    {
        long long len = 0;
        while (len < words[2 * word].size() && len < m && (words[2 * word][len] == str[len]))
        {
            dyn[len] = min(dyn[len], (unsigned long long)prices[word]);
            len++;
        }
    }

    for (long long pos = 0; pos < m; pos++)
    {
        for (long long word = 0; word < n; word++)
        {
            if (SUB_7_OPTIMIZE && (word % 5 == 0))
            {
                continue;
            }
            long long len = 0;
            while (len < words[2 * word + 1].size() && pos >= len && (words[2 * word + 1][len] == str[pos - len]))
            {
                if (pos == len)
                {
                    dyn[pos] = min(dyn[pos], (unsigned long long)prices[word]);
                }
                else if (dyn[pos - len - 1] < MAGIC)
                {
                    dyn[pos] = min(dyn[pos], dyn[pos - len - 1] + prices[word]);
                }
                len++;
            }
        }
        if (dyn[pos] < MAGIC)
        {
            for (long long word = 0; word < n; word++)
            {
                long long len = 0;
                while (len < words[2 * word].size() && pos + len + 1 < m && (words[2 * word][len] == str[pos + len + 1]))
                {
                    dyn[pos + len + 1] = min(dyn[pos + len + 1], dyn[pos] + prices[word]);
                    len++;
                }
            }
        }
    }
    if (dyn[m - 1] >= MAGIC)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << dyn[m - 1] << endl;
    }
    return 0;
}
