#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll LASTBIT(ll mask){return (mask) & (-mask);}
long pop_cnt(ll mask){return __builtin_popcountll(mask);}
long ctz(ll mask){return __builtin_ctzll(mask);}
long clz(ll mask){return __builtin_clzll(mask);}
long logOf(ll mask){return 63 - clz(mask);}
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
template <class T1, class T2>
bool maximize(T1 &a, T2 b){
if (a < b) {a = b; return true;}
return false;
}
template <class T1, class T2>
bool minimize(T1 &a, T2 b){
if (a > b) {a = b; return true;}
return false;
}
template <class T>
void printArr(T& container, char separator = ' ', char finish = '\n'){
for(auto item: container) cout << item << separator;
cout << finish;
}
template <class T>
void compress(vector<T> &a){
sort(ALL(a));
a.resize(unique(ALL(a)) - a.begin());
}
const long MOD = 1e9 + 7;
const long MAX = 1e5 + 9;
const long BASE = 307;
const long MOD1 = 1e9 + 7;
const long MOD2 = 1e9 + 9;
ll pow1[MAX], pow2[MAX];
void prepare(){
pow1[0] = pow2[0] = 1;
for(long i = 1; i<MAX; ++i){
pow1[i] = pow1[i-1] * BASE % MOD1;
pow2[i] = pow2[i-1] * BASE % MOD2;
}
}
struct Hash{
long n;
vector<ll> hash1, hash2;
Hash(string s){
n = s.size();
hash1.resize(n+1); hash2.resize(n+1);
for(long i = 1; i<=n; ++i){
hash1[i] = (hash1[i-1] + pow1[i-1] * s[i-1]) % MOD1;
hash2[i] = (hash2[i-1] + pow2[i-1] * s[i-1]) % MOD2;
}
}
ll get1(long l, long r){
return (hash1[r] - hash1[l - 1] + MOD1) * pow1[MAX - l] % MOD1;
}
ll get2(long l, long r){
return (hash2[r] - hash2[l - 1] + MOD2) * pow2[MAX - l] % MOD2;
}
ll getCode(long l, long r){
return MOD2 * get1(l, r) + get2(l, r);
}
};
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
prepare();
long n;
cin >> n;
vector<string> a(n);
vector<long> len(n);
for(long i = 0; i<n; ++i){
cin >> a[i];
len[i] = a[i].size();
}
compress(len);
long k = len.size();
vector<vector<ll>> hashCode(k);
for(long i = 0; i<n; ++i){
Hash x(a[i]);
long idx = lower_bound(ALL(len), a[i].size()) - len.begin();
hashCode[idx].push_back(x.getCode(1, a[i].size()));
}
for(long i = 0; i<k; ++i)
sort(ALL(hashCode[i]));
string s; cin >> s;
long m = s.size();
vector<ll> dp(m + 1);
dp[0] = 1;
Hash x(s);
for(long i = 0; i<m; ++i)
for(long j = 0; j<k; ++j){
if (i + len[j] > m) break;
ll hentaiCode = x.getCode(i + 1, i + len[j]);
long cnt = upper_bound(ALL(hashCode[j]), hentaiCode) - lower_bound(ALL(hashCode[j]), hentaiCode);
dp[i + len[j]] += dp[i] * cnt;
if (dp[i + len[j]] >= MOD) dp[i + len[j]] %= MOD;
}
cout << dp[m] << "\n";
return 0;
}