#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


template<long long int mod=1000000007>
struct Mod_Int{
    typedef long long int ll;
    typedef pair<ll,ll> pll;
    typedef Mod_Int<mod> M;
    ll a;
    
    ll mod_pow(ll a,ll x){
        a%=mod;
        ll ans=1;
        for(int i=0;i<63;i++){
            if(x>>i&1){ans*=a; ans%=mod;}
            a*=a;
            a%=mod;
        }
        return ans;
    }
    
    pll Ex_gcd(ll a,ll b){
        if(b==0){return {1,0};}
        pll ret=Ex_gcd(b,a%b);
        ret.F-=a/b*ret.S;
        return {ret.S,ret.F};
    }
    
    ll prime_R(ll a){
        return mod_pow(a,mod-2);
    }
    
    ll R(ll a){
        ll ret=Ex_gcd(a,mod).F;
        ret%=mod;
        if(ret<0){ret+=mod;}
        return ret;
    }
    
    Mod_Int(ll A=1):a(A){
        a%=mod;
        if(a<0){a+=mod;}
    }
    
    Mod_Int(const M &b):a(b.a){}
    
    M & operator += (const M &b){
        a+=b.a;
        if(a>=mod){a-=mod;}
        return *this;
    }
    
    M operator + (const M &b) const {
        M c=*this;
        return c+=b;
    }
    
    M & operator -= (const M &b){
        a-=b.a;
        if(a<0){a+=mod;}
        return *this;
    }
    
    M operator - (const M &b) const {
        M c=*this;
        return c-=b;
    }
    
    M & operator *= (const M &b){
        (a*=b.a)%=mod;
        return *this;
    }
    
    M operator * (const M &b) const {
        M c=*this;
        return c*=b;
    }
    
    M & operator /= (const M &b){
        (a*=R(b.a))%=mod;
        return *this;
    }
    
    M operator / (const M &b) const {
        M c=*this;
        return c/=b;
    }
    
    M & mod_pow_equal(ll x){
        ll ans=1;
        while(x>0){
            if(x&1){ans*=a; ans%=mod;}
            a*=a;
            a%=mod;
            x>>=1;
        }
        a=ans;
        return *this;
    }
    
    M & mod_pow(ll x){
        M c(a);
        return c.mod_pow_equal(x);
    }
    
    bool operator == (const M &b) const {return a==b.a;}
    
    bool operator != (const M &b) const {return a!=b.a;}
    
    bool operator <= (const M &b) const {return a<=b.a;}
    
    bool operator < (const M &b) const {return a<b.a;}
    
    bool operator > (const M &b) const {return a>b.a;}
    
    bool operator >= (const M &b) const {return a>=b.a;}
    
    M & operator = (const M &b){
        a=b.a;
        return *this;
    }
    
    M & operator = (const ll &b){
        (a=b)%=mod;
        if(a<0){a+=mod;}
        return *this;
    }
};

struct Aho{
    struct node{
        ll idx;
        char c;
        map<char,node*> next;
        node* parent;
        node* back;
        bool exist;
        vector<ll> dp;
        
        //bool used;
        
        node():next(),dp(){
            idx=-1;
            c=-1;
            parent=NULL;
            back=NULL;
            exist=false;
        }
    };
    
    node root;
    ll size;
    
    ll add(const string &s){
        node* where=&root;
        bool New=false;
        for(int i=0;i<s.size();i++){
            if(where->next.find(s[i])==where->next.end()){
                New=true;
                node* P=(node*)calloc(1,sizeof(node));
                *P=node();
                where->next[s[i]]=P;
                P->parent=where;
                where=P;
                //where->idx=size++;
                where->c=s[i];
            }
            else{
                where=where->next[s[i]];
                New=false;
            }
        }
        where->idx=size++;
        where->dp.push_back(where->idx);
        where->exist=true;
        return where->idx;
    }
    
    void build(){
        queue<node*> Q;
        for(auto i=root.next.begin();i!=root.next.end();++i){
            Q.push(i->second);
        }
        while(!Q.empty()){
            node* where=Q.front();
            Q.pop();
            if(where->parent==&root){
                where->back=&root;
            }
            else{
                node* P=where->parent->back;
                while(1){
                    if(P==&root && P->next.find(where->c)==P->next.end()){where->back=&root; break;}
                    if(P->next.find(where->c)!=P->next.end()){
                        P=P->next.find(where->c)->second;
                        where->back=P;
                        for(auto &i:P->dp){where->dp.push_back(i);}
                        break;
                    }
                    P=P->back;
                }
            }
            for(auto i=where->next.begin();i!=where->next.end();++i){
                Q.push(i->second);
            }
        }
    }
    
    /*
    vector<ll> search(const string &s){
        vector<ll> used;
        vector<node*> B;
        node* where=&root;
        for(int i=0;i<s.size();i++){
            while(where!=&root && where->next.find(s[i])==where->next.end()){
                where=where->back;
            }
            if(where->next.find(s[i])==where->next.end()){continue;}
            where=where->next.find(s[i])->second;
            if(!where->used){
                queue<node*> q;
                q.push(where);
                while(!q.empty()){
                    node* W=q.front();
                    q.pop();
                    W->used=true;
                    used.push_back(W->idx);
                    B.push_back(W);
                    if(!W->parent->used){
                        q.push(W->parent);
                    }
                    if(!W->back->used){
                        q.push(W->back);
                    }
                }
            }
        }
        sort(used.begin(),used.end());
        for(auto &i:B){i->used=false;}
        return used;
    }
     */
    
    node* move(node* where,const char &c){
        while(where!=&root && where->next.find(c)==where->next.end()){
            where=where->back;
        }
        if(where->next.find(c)!=where->next.end()){where=where->next.find(c)->second;}
        return where;
    }
    
    Aho():root(),size(0){root.back=&root; /*root.used=true;*/}
    
    node* Root(){return &root;}
};


typedef Mod_Int<1000000007> Int;


int main(){
    ll n;
    cin>>n;
    Aho A;
    vector<ll> str(n);
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        ll a=A.add(s);
        str[i]=s.size();
    }
    string s;
    cin>>s;
    vector<Int> dp(s.size()+1,0);
    dp[0]=1;
    A.build();
    auto I=A.Root();
    for(int i=0;i<s.size();i++){
        I=A.move(I,s[i]);
        for(ll &t:I->dp){
            dp[i+1]+=dp[i+1-str[t]];
        }
    }
    cout<<dp[s.size()].a<<endl;
    
    return 0;
}

