import Main.AhoCorasick.Automaton

import scala.annotation.tailrec
import scala.collection.mutable
import scala.io.StdIn

object Main extends App {
  import scala.io.StdIn._

  val file = StdIn

  val n = file.readLine.toInt
  val patterns = Array.tabulate(n){_ ⇒ file.readLine.trim}
  val target = file.readLine.trim
  println(solve(target, patterns))
  def solve(target: String, patterns: Array[String]): Long = {
    val mod = 1000000007L
    val aho = AhoCorasick(patterns)
    val memo = Array.tabulate(target.length + 1){_ ⇒ 0L}.also(_(0) = 1L)
    val automaton = aho.makeAutomaton
    for (i ← target.indices){
      automaton.move(target(i))
      for (length ← automaton.matchLength){
        memo(i + 1) += memo(i - length + 1)
      }
      memo(i + 1) %= mod
    }
    memo.last
  }

  object AhoCorasick {
    private object Trie{
      def apply(patterns: Iterable[String]): Trie = {
        val res = new Trie
        for (pattern ← patterns) {
          var length = 0
          var current = res
          while (length != pattern.length) {
            current.child.find(_._1 == pattern(length)) match {
              case Some((_, trie)) ⇒
                current = trie
                length += 1
              case None ⇒
                val next = new Trie
                current.child ::= (pattern(length), next)
                current = next
                length += 1
            }
          }
          current.word = pattern
        }
        res
      }
    }

    private class Trie {
      private var word: String = ""
      private[AhoCorasick] def pattern: String = word
      private var child: List[(Char, Trie)] = Nil
      private[AhoCorasick] def children: List[(Char, Trie)] = child
    }
    def apply(patterns: Iterable[String]): AhoCorasick = {
      val trie = Trie(patterns)
      val root = new AhoCorasick().also{aho ⇒
        aho.pattern = trie.pattern
      }
      val queue: mutable.Queue[(AhoCorasick, Trie)] = mutable.Queue((root, trie))
      while (queue.nonEmpty){
        val (aho, trie) = queue.dequeue()
        for ((c, t) ← trie.children){
          val next = new AhoCorasick().also{it ⇒
            it.pattern = t.pattern
            val (f, m) = findNext(aho, c)
            it.failure = f
            it.matchLength = if (it.hasPattern) t.pattern.length::m else m
          }
          aho.child ::= (c, next)
          queue.enqueue((next, t))
        }
      }
      root
    }
    @tailrec
    private[this] def addToResult(current: AhoCorasick, length: Int, result: List[(Int, Int)]): List[(Int, Int)] = {
      if (current.isRoot) result
      else if (current.hasPattern) addToResult(current.failure, length, (length - current.patternLength, length - 1)::result)
      else addToResult(current.failure, length, result)
    }
    @tailrec
    private[this] def findNext(current: AhoCorasick, next: Char): (AhoCorasick, List[Int]) = {
      current.child.find(_._1 == next) match {
        case Some((_, t)) ⇒ (t, t.matchLength)
        case None if current.isRoot ⇒ (current, Nil)
        case _ ⇒ findNext(current.failure, next)
      }
    }
    @tailrec
    private[this] def findNext(current: AhoCorasick, target: String, length: Int): AhoCorasick = {
      current.child.find(_._1 == target(length)) match {
        case Some((_, r)) ⇒ r
        case None if current.isRoot ⇒ current
        case _ ⇒ findNext(current.failure, target, length)
      }
    }
    @tailrec
    private def findAll(current: AhoCorasick, target: String, length: Int, result: List[(Int, Int)]): List[(Int, Int)] = {
      if (target.length == length) addToResult(current, length, result)
      else findAll(findNext(current, target, length), target, length + 1, addToResult(current, length, result))
    }
    class Automaton private[AhoCorasick] (private var aho: AhoCorasick){
      def move(char: Char): Unit = {
        var isEnd = true
        while(isEnd) {
          aho.child.find(_._1 == char) match {
            case Some((_, next)) ⇒
              aho = next
              isEnd = false
            case None if aho.isRoot ⇒
              isEnd = false
            case None ⇒ aho = aho.failure
          }
        }
      }
      def matchLength: List[Int] = aho.matchLength
    }
  }
  class AhoCorasick {
    private var failure = this
    private var pattern = ""
    private var matchLength: List[Int] = Nil
    private var child = Nil: List[(Char, AhoCorasick)]
    private def isRoot: Boolean = failure == this
    private def hasPattern: Boolean = pattern != ""
    private def patternLength: Int = pattern.length
    def findAllMatch(target: String): List[(Int, Int)] = {
      AhoCorasick.findAll(this, target, 0, Nil)
    }
    def makeAutomaton: Automaton = new Automaton(this)
  }

  implicit class Scope[T](val value: T) extends AnyVal{
    @inline
    def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline
    def let[A](func: T ⇒ A): A = func(value)

  }
}
