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;
inline long long read() {
  long long s = 0;
  bool f = 0;
  char ch = ' ';
  while (!isdigit(ch)) {
    f |= (ch == '-');
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = (s << 3) + (s << 1) + (ch ^ 48);
    ch = getchar();
  }
  return (f) ? (-s) : (s);
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x < 10) {
    putchar(x + '0');
    return;
  }
  write(x / 10);
  putchar((x % 10) + '0');
  return;
}
const int N = 2005;
const long long Base = 97, Mod = 1000000007;
int n, Len;
char S[2][N], T[N];
inline void Ad(long long &x, long long y) {
  x += y;
  x -= (x >= Mod) ? Mod : 0;
}
long long Seed[N];
inline void Prepare(int n) {
  int i;
  Seed[0] = 1;
  for (i = 1; i <= n; i++) Seed[i] = 1ll * Seed[i - 1] * Base % Mod;
}
struct Hash {
  long long Hash[N];
  inline void Make(int n, char *S) {
    int i;
    Hash[0] = 0;
    for (i = 1; i <= n; i++)
      Hash[i] = (Hash[i - 1] * Base % Mod + (S[i] - 'a' + 1)) % Mod;
  }
  inline long long Ask(int l, int r) {
    return (long long)(Hash[r] + Mod - Hash[l - 1] * Seed[r - l + 1] % Mod) %
           Mod;
  }
} Pre[2], Suf[2], HT;
long long dp[2][N][N];
inline long long Solve(bool opt) {
  long long res = 0;
  int i, j, k;
  memset(dp, 0, sizeof dp);
  for (j = 1; j <= n; j++) {
    dp[0][j][0] = dp[1][j][0] = 1;
    for (i = 0; i <= 1; i++)
      for (k = 2; k <= min(n - j + 1, Len / 2); k++) {
        if (Pre[i].Ask(j, j + k - 1) == HT.Ask(Len - 2 * k + 1, Len - k) &&
            Suf[i ^ 1].Ask(n - (j + k - 1) + 1, n - j + 1) ==
                HT.Ask(Len - k + 1, Len)) {
          if ((k * 2 != Len) || opt) Ad(res, dp[i][j][Len - k * 2]);
        }
      }
    for (i = 0; i <= 1; i++)
      for (k = 2; k <= min(j, Len / 2); k++) {
        if (Suf[i].Ask(n - j + 1, n - (j - k + 1) + 1) == HT.Ask(1, k) &&
            Pre[i ^ 1].Ask(j - k + 1, j) == HT.Ask(k + 1, k * 2)) {
          if ((k * 2 != Len) || opt) Ad(dp[i ^ 1][j + 1][k * 2], 1);
        }
      }
    for (i = 0; i <= 1; i++)
      for (k = 1; k <= Len; k++) {
        if (T[k] == S[i][j]) {
          Ad(dp[i][j + 1][k], dp[i][j][k - 1]);
          if (k < Len && T[k + 1] == S[i ^ 1][j]) {
            Ad(dp[i ^ 1][j + 1][k + 1], dp[i][j][k - 1]);
          }
        }
      }
    for (i = 0; i <= 1; i++) Ad(res, dp[i][j + 1][Len]);
  }
  return res;
}
int main() {
  long long i, j, ans = 0;
  Prepare(2000);
  scanf("%s", S[0] + 1);
  n = strlen(S[0] + 1);
  scanf("%s", S[1] + 1);
  scanf("%s", T + 1);
  Len = strlen(T + 1);
  for (i = 0; i <= 1; i++) {
    Pre[i].Make(n, S[i]);
    reverse(S[i] + 1, S[i] + n + 1);
    Suf[i].Make(n, S[i]);
    reverse(S[i] + 1, S[i] + n + 1);
  }
  HT.Make(Len, T);
  Ad(ans, Solve(1));
  if (Len > 1) {
    reverse(T + 1, T + Len + 1);
    HT.Make(Len, T);
    Ad(ans, Solve(0));
  }
  if (Len == 2) {
    for (j = 1; j <= n; j++)
      for (i = 0; i <= 1; i++)
        if (S[i][j] == T[1] && S[i ^ 1][j] == T[2]) Ad(ans, Mod - 1);
  }
  write(ans), putchar('\n');
  return 0;
}