#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


// int main(){
// 
// 
//   return 0;
// }

/* Rolling Hash */
// n = 9973, 10007

struct RollingHash{
  int N, base;
  ll hash[SIZE], pow[SIZE];

  template <typename Type>
  RollingHash(int base, int n, Type *arr):
    N(n), base(base)
  {
    hash[0] = 0;
    pow[0] = 1;
    for(int i=0; i<N; i++){
      hash[i+1] = (hash[i] + arr[i]) * base % mod;
      pow[i+1] = pow[i] * base % mod;
    }
  }

  // get [l,r)
  ll getHash(int l, int r) {
    return (mod + hash[r] - hash[l] * pow[r-l] % mod) % mod;
  }
};

const int base1 = 9973;
const int base2 = 10007;

set<pair<ll,ll>> ss[700];
map<int,int> dict;
int dicti = 0;
vector<int> vec;

ll getHash(int base, int n, char *arr){
  RollingHash rh(base, n, arr);
  return rh.getHash(0, n);
}

char s[SIZE], t[SIZE];
ll dp[SIZE] = {};

int main(){
  int n;

  scanf("%d", &n);

  for(int i=0;i<n;i++){
    scanf("%s", s);
    int m = strlen(s);
    ll h1 = getHash(base1, m, s);
    ll h2 = getHash(base2, m, s);
    vec.push_back(m);
    if(dict.find(m) == dict.end()) dict[m] = dicti++;
    ss[dict[m]].insert({h1, h2});
  }

  scanf("%s", t);

  int m = strlen(t);
  RollingHash rh1(base1, m, t), rh2(base2, m, t);

  dp[0] = 1;

  for(int i=0;i<m;i++){
    for(auto it : dict){
      int p = it.first;
      if(i+p > m) break;
      ll h1 = rh1.getHash(i, i+p);
      ll h2 = rh2.getHash(i, i+p);
      if(ss[it.second].find({h1, h2}) != ss[it.second].end())
        dp[i+p] = (dp[i+p] + dp[i]) % mod;
    }
  }

  printf("%lld\n", dp[m]);

  return 0;
}

