#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,unsigned long long>P;

int trie[200009][27],n,c,dp[100009];
string s;
typedef unsigned long long ull;
struct RollingHash{
  typedef unsigned long long ull;
  string S;
  ull B;
  int len;
  vector<ull> hash,p;
  RollingHash(){}
  RollingHash(string S_,ull B_=1000000007LL):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(int i=0;i<len;i++){
      hash[i+1]=hash[i]*B+S[i];
      p[i+1]=p[i]*B;
    }
  }
  //S[l,r)
  ull find(int l,int r){
    return hash[r]-hash[l]*p[r-l];
  }
};

signed main(){
  vector<P>v;
  r(i,200009)r(j,27)trie[i][j]=-1;
  cin>>n;
  string t[n];
  r(i,n){
    cin>>s;
    if(s.size()<=500){
        int idx=0;
        r(j,s.size()){
            int p=s[j]-'a';
            if(trie[idx][p]==-1) trie[idx][p]=++c;
            idx=trie[idx][p];
        }
        trie[idx][26]=1;
    }
    else{
        RollingHash R(s);
        v.push_back(P(s.size(),R.find(0,s.size())));
    }
  }
  cin>>s;
  RollingHash R(s);
  dp[0]=1;
  r(i,s.size()){
    int idx=0,sum=0,j=i;
    while(trie[idx][s[j]-'a']!=-1 && j!=s.size()){
      idx=trie[idx][s[j]-'a'];
      if(trie[idx][26]==1)dp[j+1]+=dp[i];
      j++;
      dp[j]%=1000000007;
    }
    r(j,v.size()){
        int len=v[j].first;
        if(len+i>s.size())continue;
        if(R.find(i,i+len)==v[j].second){
            dp[i+len]+=dp[i];
            dp[i+len]%=1000000007;
        }
    }
  }
  cout<<dp[s.size()]<<endl;
}
