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;
const int mo = 1000000007;
char S[2005], A[2][2005];
int ans, n, m, P[2][2005][2005], Q[2][2005][2005];
long long H[2005], w[2][2005], W[2005], N[2005];
bool IS(int u, int p, int q, int l, int r) {
  return (w[u][q] - w[u][p - 1]) * H[2000 - p] ==
         (W[r] - W[l - 1]) * H[2000 - l];
}
bool NS(int u, int p, int q, int l, int r) {
  return (w[u][q] - w[u][p - 1]) * H[2000 - p] ==
         (N[l] - N[r + 1]) * H[1999 - m + r];
}
int main() {
  scanf("%s", A[0] + 1);
  scanf("%s", A[1] + 1);
  n = strlen(A[0] + 1);
  scanf("%s", S + 1);
  m = strlen(S + 1);
  H[0] = 1;
  for (int i = 1; i <= 2000; ++i) H[i] = H[i - 1] * 29;
  for (int i = 1; i <= n; ++i) {
    w[0][i] = w[0][i - 1] + 1ll * (A[0][i] - 'a') * H[i];
    w[1][i] = w[1][i - 1] + 1ll * (A[1][i] - 'a') * H[i];
  }
  for (int i = 1; i <= m; ++i) W[i] = W[i - 1] + 1ll * (S[i] - 'a') * H[i];
  for (int i = m; i >= 1; --i)
    N[i] = N[i + 1] + 1ll * (S[i] - 'a') * H[m - i + 1];
  for (int u = 0; u < 2; ++u)
    for (int i = 0; i <= n + 1; ++i) P[u][i][m + 1] = Q[u][i][m + 1] = 1;
  for (int i = n; i; --i)
    for (int j = 1; j <= m; ++j)
      for (int u = 0, v = 1; u < 2; ++u, v = 0)
        if (A[u][i] == S[j]) {
          P[u][i][j] = P[u][i + 1][j + 1];
          if (A[v][i] == S[j + 1]) (P[u][i][j] += P[v][i + 1][j + 2]) %= mo;
          if ((m - j + 1) % 2 == 0 && m - j + 1 <= (n - i + 1) * 2) {
            int x = m - j + 1 >> 1;
            if (x > 1 && IS(u, i, i + x - 1, j, j + x - 1) &&
                NS(v, i, i + x - 1, j + x, m))
              (++P[u][i][j]) %= mo;
          }
        }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      for (int u = 0, v = 1; u < 2; ++u, v = 0)
        if (A[u][i] == S[j]) {
          Q[u][i][j] = Q[u][i - 1][j + 1];
          if (A[v][i] == S[j + 1]) (Q[u][i][j] += Q[v][i - 1][j + 2]) %= mo;
          if ((m - j + 1) % 2 == 0 && m - j + 1 <= i * 2) {
            int x = m - j + 1 >> 1;
            if (x > 1 && NS(u, i - x + 1, i, j, j + x - 1) &&
                IS(v, i - x + 1, i, j + x, m))
              (++Q[u][i][j]) %= mo;
          }
        }
  for (int i = 1; i <= n; ++i)
    for (int u = 0, v = 1; u < 2; ++u, v = 0)
      if (A[u][i] == S[1]) {
        if (m == 1) {
          ++ans;
          continue;
        }
        if (A[v][i] == S[2])
          if (m == 2)
            ++ans;
          else
            (ans += (P[v][i + 1][3] + Q[v][i - 1][3]) % mo) %= mo;
        for (int j = 2; j <= m && j <= n - i + 1; ++j) {
          if (!IS(u, i, i + j - 1, 1, j)) break;
          if (j == m) {
            (++ans) %= mo;
            break;
          }
          if (A[v][i + j - 1] != S[j + 1]) continue;
          if (j + 1 == m) {
            (++ans) %= mo;
            continue;
          }
          if (j * 2 <= m) {
            if (NS(v, i, i + j - 1, j + 1, j * 2))
              (ans += Q[v][i - 1][j * 2 + 1]) %= mo;
          } else if (NS(v, i + j - m + j, i + j - 1, j + 1, m))
            (++ans) %= mo;
          (ans += P[v][i + j][j + 2]) %= mo;
        }
        for (int j = 2; j <= m && j <= i; ++j) {
          if (!NS(u, i - j + 1, i, 1, j)) break;
          if (j == m) {
            (++ans) %= mo;
            break;
          }
          if (A[v][i - j + 1] != S[j + 1]) continue;
          if (j + 1 == m) {
            (++ans) %= mo;
            continue;
          }
          if (j * 2 <= m) {
            if (IS(v, i - j + 1, i, j + 1, j * 2))
              (ans += P[v][i + 1][j * 2 + 1]) %= mo;
          } else if (IS(v, i - j + 1, i - j + m - j, j + 1, m))
            (++ans) %= mo;
          (ans += Q[v][i - j][j + 2]) %= mo;
        }
      }
  printf("%d\n", ans);
  return 0;
}
