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;
int read() {
  char ch = getchar();
  int x = 0, ff = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * ff;
}
void write(int aa) {
  if (aa < 0) putchar('-'), aa = -aa;
  if (aa > 9) write(aa / 10);
  putchar(aa % 10 + '0');
  return;
}
const int mod = 1e9 + 7;
int n, m, ans;
int Z[2005][2005][2][2], Y[2005][2005][2][2];
int f[2005][2005][2][2];
char A[2005], B[2005], S[2005];
int okl(int i, int j, int zl, int ff) {
  if (j % 2 != 0) return 0;
  if (j == 2) return 0;
  if (i * 2 < j) return 0;
  if (Z[i][j][zl][ff] < j / 2) return 0;
  if (Y[i - j / 2 + 1][j / 2][zl ^ 1][ff] < j / 2) return 0;
  return 1;
}
int okr(int i, int j, int zl, int ff) {
  j = m - j;
  i = n - i;
  if (j % 2 != 0) return 0;
  if (j == 2) return 0;
  if (i * 2 < j) return 0;
  if (Z[n - i + j / 2][m - j / 2][zl][ff] < j / 2) return 0;
  if (Y[n - i + 1][m][zl ^ 1][ff] < j / 2) return 0;
  return 1;
}
void solve(int ff) {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (A[i] == S[j])
        Z[i][j][0][ff] = Z[i - 1][j - 1][0][ff] + 1;
      else
        Z[i][j][0][ff] = 0;
      if (B[i] == S[j])
        Z[i][j][1][ff] = Z[i - 1][j - 1][1][ff] + 1;
      else
        Z[i][j][1][ff] = 0;
    }
  for (int i = n; i; i--)
    for (int j = 1; j <= m; ++j) {
      if (A[i] == S[j])
        Y[i][j][0][ff] = Y[i + 1][j - 1][0][ff] + 1;
      else
        Y[i][j][0][ff] = 0;
      if (B[i] == S[j])
        Y[i][j][1][ff] = Y[i + 1][j - 1][1][ff] + 1;
      else
        Y[i][j][1][ff] = 0;
    }
  f[0][0][0][ff] = 1;
  f[0][0][1][ff] = 1;
  if (okr(0, 0, 0, ff)) ans++;
  if (okr(0, 0, 1, ff)) ans++;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (A[i] == S[j]) f[i][j][0][ff] = f[i - 1][j - 1][0][ff];
      if (B[i] == S[j]) f[i][j][1][ff] = f[i - 1][j - 1][1][ff];
    }
    for (int j = m; j >= 1; --j) {
      if (A[i] == S[j]) f[i][j][0][ff] += f[i][j - 1][1][ff];
      if (B[i] == S[j]) f[i][j][1][ff] += f[i][j - 1][0][ff];
    }
    for (int j = 0; j <= m; ++j) {
      if (okl(i, j, 0, ff)) f[i][j][0][ff]++;
      if (f[i][j][0][ff] >= mod) f[i][j][0][ff] -= mod;
      if (okr(i, j, 0, ff)) ans += f[i][j][0][ff];
      if (ans >= mod) ans -= mod;
      if (okl(i, j, 1, ff)) f[i][j][1][ff]++;
      if (f[i][j][1][ff] >= mod) f[i][j][1][ff] -= mod;
      if (okr(i, j, 1, ff)) ans += f[i][j][1][ff];
      if (ans >= mod) ans -= mod;
    }
  }
  return;
}
int main() {
  scanf("%s%s%s", A + 1, B + 1, S + 1);
  n = strlen(A + 1), m = strlen(S + 1);
  solve(0);
  int qwq = 0;
  for (int i = 1; i * 2 <= m; ++i) {
    swap(S[i], S[m - i + 1]);
    if (S[i] != S[m - i + 1]) qwq = 1;
  }
  if (qwq)
    solve(1);
  else if (m != 1) {
    ans *= 2;
    if (ans >= mod) ans -= mod;
  }
  if (m != 2)
    for (int i = 0; i <= n; ++i) {
      ans -=
          okl(i, m, 0, 0) + okl(i, m, 1, 0) + okr(i, 0, 0, 0) + okr(i, 0, 1, 0);
    }
  else
    for (int i = 0; i <= n; ++i)
      ans -= (A[i] == S[1] && B[i] == S[2]) + (A[i] == S[2] && B[i] == S[1]);
  if (ans < 0) ans += mod;
  write((ans % mod + mod) % mod);
  return 0;
}
