
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define len(v) ((ll)(v.size()))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inp(a) for(auto &x:a) cin>>x;
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vs vector<string>
#define vchar vector<char>
#define vvchar vector<vector<char>> 
#define vpll vector<pair<ll,ll>> 
#define mll map<ll,ll> 
#define sll set<ll>
#define pn cout<<"NO\n"
#define py cout<<"YES\n"
#define pll pair<ll,ll> 
const ll MAX_SIZE = 100005;
const ll ninf = (-1)*(1ll<<60);
const ll inf = 1ll<<60;
const ll mod = 1000000007;
ll t[4*MAX_SIZE];
template<typename T>
void print(T t)
{
    for(const auto &e:t) cout<<e<<" ";
    cout<<"\n";
}
ll fastpow(ll a ,ll b){
    ll res=1;
    while(b){
       if(b&1) res=(res*a)%mod;
       a=(a*a)%mod;
       b/=2;
    }
    return res;
}
struct hashFunction
{
  size_t operator()(const pair<ll , 
                    ll> &x) const
  {
    return x.first ^ x.second;
  }
};
  
ll p1=31,p2=67;
ll inv1[MAX_SIZE];
ll pt1[MAX_SIZE];
ll inv2[MAX_SIZE];
ll pt2[MAX_SIZE];

void solve(ll TC)
{
   ll n;
   cin>>n;
   vs v(n);
   inp(v);
   string s;
   cin>>s;

   unordered_set<pll,hashFunction> m;
   vll leng;
   vll freq(1e5,0);


   for(auto x:v){
       ll hash_value1=0; 
       ll hash_value2=0;
       for(ll i=0;i<len(x);i++){
          hash_value1=(hash_value1+pt1[i]*(x[i]-'a'+1))%mod;
          hash_value2=(hash_value2+pt2[i]*(x[i]-'a'+1))%mod;
       }
       m.insert({hash_value1,hash_value2});
       if(freq[len(x)]==0) leng.push_back(len(x));
       freq[len(x)]=1;
   }

   sort(all(leng));
   

   vll hash1(len(s)+1,0),hash2(len(s)+1,0);

   for(ll i=1;i<=len(s);i++){
       hash1[i]=(hash1[i-1]+pt1[i-1]*(s[i-1]-'a'+1))%mod;
       hash2[i]=(hash2[i-1]+pt2[i-1]*(s[i-1]-'a'+1))%mod;
   }

   vll dp(len(s)+1,0);
   dp[0]=1;

   for(ll i=1;i<=len(s);i++){
        for(auto l:leng){
            if(l>i) break;
            ll k1=((hash1[i]-hash1[i-l]+mod)*inv1[i-l])%mod;
            ll k2=((hash2[i]-hash2[i-l]+mod)*inv2[i-l])%mod;
            if(m.count({k1,k2})) dp[i]=(dp[i]+dp[i-l])%mod;
        }            
   }

   cout<<dp[len(s)]%mod<<endl;

}
 
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
    ll Tc=1;
    // cin>>Tc;
    pt1[0]=1,pt2[0]=1;
    inv1[0]=fastpow(1,mod-2);
    inv2[0]=inv1[0];
    ll k1=fastpow(p1,mod-2);
    ll k2=fastpow(p2,mod-2);
    for(ll i=1;i<MAX_SIZE;i++){
        pt1[i]=(pt1[i-1]*p1)%mod;
        inv1[i]=(inv1[i-1]*k1)%mod;
        pt2[i]=(pt2[i-1]*p2)%mod;
        inv2[i]=(inv2[i-1]*k2)%mod;
    }

 
    for(ll tc=1;tc<=Tc;tc++)
    {
        solve(tc);
    }
 
return 0;
}
/*
1. Initialize all variables! Arrays etc.
2. Min of Max and Max of Min, such type of problems usually require Binary Search
3. Use to_string and stoi,atoi for conversions to suitable types.
4. For setting precision of n digits after decimal, use cout<<fixed;cout<<setprecision(n); before output, or at start of code if all outputs have same precision(include ios and iomanip header files.
5. Instead os using ceil(a/b), use (a+b-1)/b or (a-1)/b+1.
6. For char to int, subtract '0', for int to char add'0'
*/