#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll in()
{
    ll re=0,f=1;char x=getchar();
    while(x<'0'||x>'9'){if(x=='-')f=-1;x=getchar();}
    while(x>='0'&&x<='9')re=re*10+x-48,x=getchar();
    return re*f;
}
void out(ll x)
{
    if(x<0)putchar('-'),x=-x;
    if(!x){putchar('0');return;}
    char z[21],ct=0;
    while(x){z[++ct]=x%10+48,x/=10;}
    while(ct){putchar(z[ct]);--ct;}
}
int n;
char ss[500000];
int s[100010],pt;
int len[100010],tlen;
char t[100010];
int ptr=1;
const ll mod=1e9+7;
struct node{
    int ch[26],fa;
    char v;
    vector<int>cnt;
}nd[200010];
void ins(int l,int len)
{
    int cur=1;
    for(int i=l;i<l+len;++i)
    {
        char c=ss[i];
        if(!nd[cur].ch[c-'a'])
        {
            nd[cur].ch[c-'a']=++ptr;
            nd[ptr].fa=cur;
            nd[ptr].v=c;
        }
        cur=nd[cur].ch[c-'a'];
    }
    nd[cur].cnt.push_back(len);
}
int fail[200010];
void bfs()
{
    queue<int>q;
    fail[1]=1;
    for(int i=0;i<26;++i)
    if(nd[1].ch[i])
    {
        fail[nd[1].ch[i]]=1;
        q.push(nd[1].ch[i]);
    }
    else nd[1].ch[i]=1;
    while(!q.empty())
    {
        int h=q.front();q.pop();
        for(int i=0;i<26;++i)
        if(nd[h].ch[i])
        {
            fail[nd[h].ch[i]]=nd[fail[h]].ch[i];
            q.push(nd[h].ch[i]);
        }
        else nd[h].ch[i]=nd[fail[h]].ch[i];
    }
}
ll dp[200010];
int main()
{
    scanf("%d\n",&n);
    for(int i=1;i<=n;++i)
    {
        scanf("%s",ss+pt);
        s[i]=pt;
        len[i]=strlen(ss+pt);
        pt=pt+len[i]+1;
    }
    for(int i=1;i<=n;++i)
        ins(s[i],len[i]);
    bfs();
    scanf("%s",t+1);
    tlen=strlen(t+1);
    dp[0]=1;
    int cur=1;
    for(int i=1;i<=tlen;++i)
    {
        cur=nd[cur].ch[t[i]-'a'];
        int now=cur;
        while(now>1)
        {
            vector<int>&v=nd[now].cnt;
            for(int j=0;j<v.size();++j)
                dp[i]=(dp[i]+dp[i-v[j]])%mod;
            now=fail[now];
        }
    }
    cout<<dp[tlen]<<'\n';
}
