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

template <class Container>
std::vector<int> zalgo(const Container& dat) {
    int n = dat.size();

    std::vector<int> ret(n);
    ret[0] = n;

    int i = 1, len = 0;
    while (i < n) {
        while (i + len < n && dat[len] == dat[i + len]) {
            ++len;
        }
        ret[i] = len;

        if (len == 0) {
            ++i;
            continue;
        }

        int nlen = 1;
        while (i + nlen < n && nlen + ret[nlen] < len) {
            ret[i + nlen] = ret[nlen];
            ++nlen;
        }

        i += nlen;
        len -= nlen;
    }

    return ret;
}

constexpr int MOD = 1000000007;
constexpr int S = 100;

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::set<std::string>> ses(S);
    std::vector<std::string> ss;

    while (n--) {
        std::string s;
        std::cin >> s;

        if ((int)s.length() < S) {
            ses[s.length()].insert(s);
        } else {
            ss.push_back(s);
        }
    }

    std::string t;
    std::cin >> t;
    int m = t.length();

    std::vector<std::vector<int>> to(m);
    for (int i = 0; i < m; ++i) {
        for (int k = 0; k < S; ++k) {
            if (ses[k].count(t.substr(i, k))) {
                to[i].push_back(i + k);
            }
        }
    }

    for (auto s : ss) {
        int l = s.length();
        s += t;
        auto vs = zalgo(s);
        for (int i = 0; i < m; ++i) {
            if (vs[i + l] >= l) to[i].push_back(i + l);
        }
    }

    std::vector<int> dp(m + 1, 0);
    dp[0] = 1;
    for (int i = 0; i < m; ++i) {
        for (auto j : to[i]) {
            (dp[j] += dp[i]) %= MOD;
        }
    }
    std::cout << dp.back() << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}

