Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long int modulo = 1e9 + 7;
void anyade(long long int &a, long long int b) { a = (a + b) % modulo; }
long long int sol = 0;
int n;
int k;
int input[2][2005];
long long int w[2005];
int coincidele[2005][2][2005];
int coincideri[2005][2][2005];
bool cierrale(int i, int j, int iw) {
  int o = 1 - i;
  if (iw % 2 != 0 or iw < 4) return false;
  iw /= 2;
  if (j - iw + 1 < 1) return false;
  return coincidele[1][i][j] >= iw and coincideri[iw + 1][o][j - iw + 1] >= iw;
}
bool cierrari(int i, int j, int iw) {
  int o = 1 - i;
  int len = k - iw + 1;
  if (len % 2 != 0 or len < 2) return false;
  len /= 2;
  if (j + len - 1 > n) return false;
  return coincideri[k - len - len + 1][i][j] >= len and
         coincidele[k - len + 1][o][j + len - 1] >= len;
  return true;
}
void escribe(long long int maneras[2005][2][2005], int iw) {
  cout << "paso " << iw << endl;
  for (int i = 0; i <= 1; i++) {
    for (int j = 1; j <= n; j++) cout << maneras[iw][i][j] << ",";
    cout << endl;
  }
  cout << endl;
}
void calcula(long long int maneras[2005][2][2005]) {
  for (int iw = k; iw >= 1; iw--) {
    for (int i = 0; i <= 1; i++) {
      for (int j = 1; j <= n; j++) {
        coincideri[iw][i][j] =
            w[iw] == input[i][j] ? 1 + coincideri[iw + 1][i][j + 1] : 0;
        coincidele[iw][i][j] =
            w[iw] == input[i][j] ? 1 + coincidele[iw + 1][i][j - 1] : 0;
      }
    }
  }
  for (int i = 0; i <= 1; i++) {
    for (int j = 1; j <= n; j++) {
      maneras[1][i][j] = input[i][j] == w[1];
      if (cierrari(i, j, 1)) anyade(sol, 1);
    }
  }
  for (int iw = 2; iw <= k; iw++) {
    char c = w[iw];
    for (int i = 0; i <= 1; i++) {
      for (int j = 1; j <= n; j++) {
        if (input[i][j] == c) {
          int o = 1 - i;
          long long int &mem = maneras[iw][i][j];
          anyade(mem, maneras[iw - 1][i][j - 1]);
          if (input[i][j - 1] == w[iw - 1])
            anyade(mem, maneras[iw - 2][o][j - 1]);
          if (cierrale(o, j - 1, iw - 1)) anyade(mem, 1);
          if (iw == k or cierrari(i, j, iw)) anyade(sol, mem);
        }
      }
    }
  }
}
long long int maneras[2][2005][2][2005];
int main() {
  string s;
  for (int i = 0; i <= 1; i++) {
    cin >> s;
    n = int(s.size());
    for (int j = 1; j <= n; j++) input[i][j] = s[j - 1];
  }
  cin >> s;
  k = int(s.size());
  for (int iw = 1; iw <= k; iw++) w[iw] = s[iw - 1];
  if (k == 1) {
    for (int i = 0; i <= 1; i++)
      for (int j = 1; j <= n; j++) sol += input[i][j] == w[1];
  } else if (k == 2) {
    for (int i = 0; i <= 1; i++) {
      for (int j = 1; j < n; j++) {
        sol += input[i][j] == w[1] and input[i][j + 1] == w[2];
        sol += input[i][j] == w[2] and input[i][j + 1] == w[1];
      }
    }
    for (int j = 1; j <= n; j++) {
      sol += input[0][j] == w[1] and input[1][j] == w[2];
      sol += input[0][j] == w[2] and input[1][j] == w[1];
    }
  } else {
    calcula(maneras[0]);
    for (int i = 0; i <= 1; i++)
      for (int j1 = 1, j2 = n; j1 < j2; j1++, j2--)
        swap(input[i][j1], input[i][j2]);
    calcula(maneras[1]);
  }
  cout << sol << endl;
}