Oleg Petrov loves crossword puzzles and every Thursday he buys his favorite magazine with crosswords and other word puzzles. In the last magazine Oleg found a curious puzzle, and the magazine promised a valuable prize for it's solution. We give a formal description of the problem below.

The puzzle field consists of two rows, each row contains n cells. Each cell contains exactly one small English letter. You also are given a word w, which consists of k small English letters. A solution of the puzzle is a sequence of field cells c1, ..., ck, such that:

  * For all i from 1 to k the letter written in the cell ci matches the letter wi;
  * All the cells in the sequence are pairwise distinct;
  * For all i from 1 to k - 1 cells ci and ci + 1 have a common side.



Oleg Petrov quickly found a solution for the puzzle. Now he wonders, how many distinct solutions are there for this puzzle. Oleg Petrov doesn't like too large numbers, so calculate the answer modulo 109 + 7.

Two solutions ci and c'i are considered distinct if the sequences of cells do not match in at least one position, that is there is such j in range from 1 to k, such that cj ≠ c'j.

Input

The first two lines contain the state of the field for the puzzle. Each of these non-empty lines contains exactly n small English letters.

The next line is left empty.

The next line is non-empty and contains word w, consisting of small English letters.

The length of each line doesn't exceed 2 000.

Output

Print a single integer — the number of distinct solutions for the puzzle modulo 109 + 7.

Examples

Input

code
edoc

code


Output

4


Input

aaa
aaa

aa


Output

14
#include <bits/stdc++.h>
using namespace std;
char s1[2005], s2[2005], ss[2005];
int f1[2005][2005], f2[2005][2005], g1[2005][2005], g2[2005][2005],
    h[2005][2005], hf[2005][2005], h1[2005][2005], h2[2005][2005];
int i, j, n, m, len, ans, MOD = 1000000007;
void pre() {
  for (i = 1; i <= n; i++)
    for (j = i; j <= n; j++) {
      h1[i][j] = (23ll * h1[i][j - 1] % MOD + s1[j]) % MOD;
      h2[i][j] = (23ll * h2[i][j - 1] % MOD + s2[j]) % MOD;
    }
  for (i = 1; i <= n; i++) {
    for (j = 1; j < m; j++) {
      if (s1[i] == ss[j]) {
        f1[i][j] = (f1[i][j] + f1[i - 1][j + 1]) % MOD;
        if (s2[i] == ss[j + 1]) f1[i][j] = (f1[i][j] + f2[i - 1][j + 2]) % MOD;
      }
      if (s2[i] == ss[j]) {
        f2[i][j] = (f2[i][j] + f2[i - 1][j + 1]) % MOD;
        if (s1[i] == ss[j + 1]) f2[i][j] = (f2[i][j] + f1[i - 1][j + 2]) % MOD;
      }
    }
    if (s1[i] == ss[m]) {
      f1[i][m] = 1;
      for (j = 1; j <= i && 2 * j <= m; j++)
        if (h1[i - j + 1][i] == h[m - j + 1][m] &&
            h2[i - j + 1][i] == hf[m - j][m - 2 * j + 1])
          f2[i][m - 2 * j + 1] = (f2[i][m - 2 * j + 1] + 1) % MOD;
    }
    if (s2[i] == ss[m]) {
      f2[i][m] = 1;
      for (j = 1; j <= i && 2 * j <= m; j++)
        if (h2[i - j + 1][i] == h[m - j + 1][m] &&
            h1[i - j + 1][i] == hf[m - j][m - 2 * j + 1])
          f1[i][m - 2 * j + 1] = (f1[i][m - 2 * j + 1] + 1) % MOD;
    }
  }
  for (i = n; i; i--) {
    for (j = 1; j < m; j++) {
      if (s1[i] == ss[j]) {
        g1[i][j] = (g1[i][j] + g1[i + 1][j + 1]) % MOD;
        if (s2[i] == ss[j + 1]) g1[i][j] = (g1[i][j] + g2[i + 1][j + 2]) % MOD;
      }
      if (s2[i] == ss[j]) {
        g2[i][j] = (g2[i][j] + g2[i + 1][j + 1]) % MOD;
        if (s1[i] == ss[j + 1]) g2[i][j] = (g2[i][j] + g1[i + 1][j + 2]) % MOD;
      }
    }
    if (s1[i] == ss[m]) {
      g1[i][m] = 1;
      for (j = 1; j <= n - i + 1 && 2 * j <= m; j++)
        if (h1[i][i + j - 1] == hf[m][m - j + 1] &&
            h2[i][i + j - 1] == h[m - 2 * j + 1][m - j])
          g2[i][m - 2 * j + 1] = (g2[i][m - 2 * j + 1] + 1) % MOD;
    }
    if (s2[i] == ss[m]) {
      g2[i][m] = 1;
      for (j = 1; j <= n - i + 1 && 2 * j <= m; j++)
        if (h2[i][i + j - 1] == hf[m][m - j + 1] &&
            h1[i][i + j - 1] == h[m - 2 * j + 1][m - j])
          g1[i][m - 2 * j + 1] = (g1[i][m - 2 * j + 1] + 1) % MOD;
    }
  }
}
void calc() {
  pre();
  for (i = 1; i <= n; i++)
    if (s1[i] == ss[1])
      for (j = i; j <= n; j++) {
        int k = j - i + 1;
        if (h1[i][j] == h[1][k] && s2[j] == ss[k + 1]) {
          ans = (ans + g2[j + 1][k + 2]) % MOD;
          if (hf[k << 1][k + 1] == h2[i][j])
            ans = (ans + f2[i - 1][k << 1 | 1]) % MOD;
          if ((k << 1) >= m && m > k && hf[m][k + 1] == h2[i + (k << 1) - m][j])
            ans = (ans + 1) % MOD;
        } else if (h1[i][j] == h[1][k] && j - i + 1 == m)
          ans = (ans + 1) % MOD;
      }
  for (i = 1; i <= n; i++)
    if (s2[i] == ss[1])
      for (j = i; j <= n; j++) {
        int k = j - i + 1;
        if (h2[i][j] == h[1][k] && s1[j] == ss[k + 1]) {
          ans = (ans + g1[j + 1][k + 2]) % MOD;
          if (hf[k << 1][k + 1] == h1[i][j])
            ans = (ans + f1[i - 1][k << 1 | 1]) % MOD;
          if ((k << 1) >= m && m > j - i + 1 &&
              hf[m][k + 1] == h1[i + (k << 1) - m][j])
            ans = (ans + 1) % MOD;
        } else if (h2[i][j] == h[1][k] && j - i + 1 == m)
          ans = (ans + 1) % MOD;
      }
}
void calc2() {
  memset(f1, 0, sizeof(f1)), memset(f2, 0, sizeof(f2));
  memset(g1, 0, sizeof(g1)), memset(g2, 0, sizeof(g2));
  pre();
  for (i = 1; i <= n; i++)
    if (s1[i] == ss[1])
      for (j = i + 1; j <= n; j++) {
        int k = j - i + 1;
        if (h1[i][j] == h[1][k] && s2[j] == ss[k + 1]) {
          ans = (ans + g2[j + 1][k + 2]) % MOD;
          if (hf[k << 1][k + 1] == h2[i][j])
            ans = (ans + f2[i - 1][k << 1 | 1]) % MOD;
          if ((k << 1) >= m && m > k && hf[m][k + 1] == h2[i + (k << 1) - m][j])
            ans = (ans + 1) % MOD;
        } else if (h1[i][j] == h[1][k] && j - i + 1 == m)
          ans = (ans + 1) % MOD;
      }
  for (i = 1; i <= n; i++)
    if (s2[i] == ss[1])
      for (j = i + 1; j <= n; j++) {
        int k = j - i + 1;
        if (h2[i][j] == h[1][k] && s1[j] == ss[k + 1]) {
          ans = (ans + g1[j + 1][k + 2]) % MOD;
          if (hf[k << 1][k + 1] == h1[i][j])
            ans = (ans + f1[i - 1][k << 1 | 1]) % MOD;
          if ((k << 1) >= m && m > j - i + 1 &&
              hf[m][k + 1] == h1[i + (k << 1) - m][j])
            ans = (ans + 1) % MOD;
        } else if (h2[i][j] == h[1][k] && j - i + 1 == m)
          ans = (ans + 1) % MOD;
      }
}
int main() {
  scanf("%s", s1 + 1);
  scanf("%s", s2 + 1);
  scanf("%s", ss + 1);
  n = strlen(s1 + 1), m = strlen(ss + 1);
  for (i = 1; i <= m; i++)
    for (j = i; j <= m; j++) h[i][j] = (23ll * h[i][j - 1] % MOD + ss[j]) % MOD;
  for (i = m; i; i--)
    for (j = i; j; j--) hf[i][j] = (23ll * hf[i][j + 1] % MOD + ss[j]) % MOD;
  calc();
  for (i = 1; i <= n / 2; i++)
    swap(s1[i], s1[n - i + 1]), swap(s2[i], s2[n - i + 1]);
  calc2();
  printf("%d\n", ans);
  return 0;
}
