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>
long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
char A[2][2010], S[2010], rS[2010];
int n, m, N, Base[2010];
struct yybakioiqwqwqwq {
  int HS[2010];
  char* pp;
  void pre(char* S, int n) {
    pp = S;
    for (int i = 1; i <= n; ++i)
      HS[i] = (HS[i - 1] + 1ll * S[i] * Base[i]) % 1009260817;
  }
  int get(int l, int r) {
    return 1ll * (HS[r] - HS[l - 1] + 1009260817) * Base[N - r] % 1009260817;
  }
} hA[2], hS, hrS;
int f[2010][2][2010];
void add(int& a, int b) {
  a = a + b >= 1000000007 ? a + b - 1000000007 : a + b;
}
int work() {
  memset(f, 0, sizeof f);
  int ret = 0;
  for (int i = 1; i <= n; ++i) {
    f[i - 1][0][0] = f[i - 1][1][0] = 1;
    for (int o = 0; o < 2; ++o) {
      for (int j = i + 1; j <= n; ++j)
        if (m >= 2 * (j - i + 1) &&
            hA[o ^ 1].get(i, j) == hrS.get(1, j - i + 1) &&
            hA[o].get(i, j) == hS.get(m - 2 * (j - i + 1) + 1, m - (j - i + 1)))
          add(ret, f[i - 1][o][m - 2 * (j - i + 1)] * 1ll *
                       (m == 2 * (j - i + 1) ? (1000000007 + 1 >> 1) : 1) %
                       1000000007);
      for (int j = i - 1; j; --j)
        if (m >= 2 * (i - j + 1) &&
            hA[o ^ 1].get(j, i) == hrS.get(m - (i - j + 1) + 1, m) &&
            hA[o].get(j, i) == hS.get(i - j + 2, 2 * (i - j + 1)))
          add(f[i][o][2 * (i - j + 1)],
              (m == 2 * (i - j + 1) ? (1000000007 + 1 >> 1) : 1));
      for (int j = 0; j < i * 2; ++j)
        if (f[i - 1][o][j]) {
          if (j + 1 <= m && S[j + 1] == A[o][i]) {
            add(f[i][o][j + 1], f[i - 1][o][j]);
            if (j + 2 <= m && S[j + 2] == A[!o][i])
              add(f[i][!o][j + 2], f[i - 1][o][j]);
          }
        }
    }
    add(ret, f[i][0][m]);
    add(ret, f[i][1][m]);
  }
  return ret;
}
int main() {
  scanf("%s", A[0] + 1);
  scanf("%s", A[1] + 1);
  scanf("%s", S + 1);
  n = strlen(A[0] + 1), m = strlen(S + 1), N = std::max(n, m);
  if (m == 1) {
    int ans = 0;
    for (int i = 1; i <= n; ++i) ans += (A[0][i] == S[1]) + (A[1][i] == S[1]);
    return printf("%d\n", ans), 0;
  }
  if (m == 2) {
    int ans = 0;
    for (int o = 0; o < 2; ++o) {
      for (int i = 1; i < n; ++i)
        ans += (A[o][i] == S[1]) && (A[o][i + 1] == S[2]);
      for (int i = 1; i < n; ++i)
        ans += (A[o][i] == S[2]) && (A[o][i + 1] == S[1]);
    }
    for (int i = 1; i <= n; ++i) ans += (A[0][i] == S[1]) && (A[1][i] == S[2]);
    for (int i = 1; i <= n; ++i) ans += (A[1][i] == S[1]) && (A[0][i] == S[2]);
    return printf("%d\n", ans), 0;
  }
  Base[0] = 1;
  for (int i = 1; i <= N; ++i) Base[i] = 19260817ll * Base[i - 1] % 1009260817;
  for (int i = 0; i < 2; ++i) hA[i].pre(A[i], n);
  for (int i = 1; i <= m; ++i) rS[m - i + 1] = S[i];
  hS.pre(S, m), hrS.pre(rS, m);
  int ans = work();
  for (int i = 1, j = m; i < j; ++i, --j)
    std::swap(S[i], S[j]), std::swap(rS[i], rS[j]);
  hS.pre(S, m), hrS.pre(rS, m);
  ans = (ans + work()) % 1000000007;
  printf("%d\n", ans);
  return 0;
}