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;
const long long MAXN = 2e3 + 10;
const long long INF = 2e9;
const double eps = 1e-6;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
const long long base = 131;
long long n, k, Ans;
long long dp[3][MAXN][MAXN][2], tmp[3];
long long h[3][3][MAXN], pw[MAXN], hp[MAXN];
char s[3][MAXN], p[MAXN];
template <typename T>
inline bool read(T &a) {
  a = 0;
  char c = getchar();
  long long f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    a = a * 10 + (c ^ 48);
    c = getchar();
  }
  return a *= f, true;
}
template <typename A, typename... B>
inline bool read(A &x, B &...y) {
  return read(x) && read(y...);
}
long long H(long long opt, long long l, long long r) {
  if (l <= r)
    return (h[opt][1][r] - h[opt][1][l - 1] * pw[r - l + 1] % mod + mod) % mod;
  else
    return (h[opt][2][r] - h[opt][2][l + 1] * pw[l - r + 1] % mod + mod) % mod;
}
long long P(long long l, long long r) {
  return (hp[r] - hp[l - 1] * pw[r - l + 1] % mod + mod) % mod;
}
void modadd(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
void calc() {
  for (long long i = 1; i <= 2; ++i) {
    for (long long j = 1; j <= n; ++j)
      h[i][1][j] = (h[i][1][j - 1] * base + s[i][j]) % mod;
    for (long long j = n; j >= 1; --j)
      h[i][2][j] = (h[i][2][j + 1] * base + s[i][j]) % mod;
  }
  memset(dp, 0, sizeof dp);
  for (long long i = 1; i <= 2; ++i) {
    for (long long j = 1; j <= n; ++j) {
      for (long long L = j - 1, v, len; L >= 1; --L) {
        len = j - L + 1;
        if ((len << 1) > k) break;
        v = (H(i, j, L) * pw[len] + H(3 - i, L, j)) % mod;
        if (v == P(1, len << 1)) dp[3 - i][j][len << 1][1]++;
      }
      if (s[i][j] == p[1]) dp[i][j][1][0]++;
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long o = 1; o <= 2; ++o)
      for (long long l = 1; l <= k; ++l)
        if (s[o][i] == p[l]) {
          modadd(dp[o][i][l][0], dp[o][i - 1][l - 1][0]);
          modadd(dp[o][i][l][0], dp[o][i - 1][l - 1][1]);
        }
    for (long long l = k; l >= 2; --l) {
      if (s[2][i] == p[l]) modadd(dp[2][i][l][1], dp[1][i][l - 1][0]);
      if (s[1][i] == p[l]) modadd(dp[1][i][l][1], dp[2][i][l - 1][0]);
    }
  }
  for (long long i = 1; i <= 2; ++i) {
    for (long long j = 1; j <= n; ++j) {
      modadd(Ans, dp[i][j][k][0]);
      modadd(Ans, dp[i][j][k][1]);
      for (long long R = j + 1, len, v; R <= n; ++R) {
        len = R - j + 1;
        if ((len << 1) > k) break;
        v = (H(i, j, R) * pw[len] + H(3 - i, R, j)) % mod;
        if (v == P(k - (len << 1) + 1, k)) {
          modadd(Ans, dp[i][j - 1][k - (len << 1)][0]);
          modadd(Ans, dp[i][j - 1][k - (len << 1)][1]);
        }
      }
    }
  }
}
signed main() {
  scanf("%s%s%s", s[1] + 1, s[2] + 1, p + 1);
  n = strlen(s[1] + 1), k = strlen(p + 1);
  pw[0] = 1;
  for (long long i = 1; i < MAXN; ++i) pw[i] = pw[i - 1] * base % mod;
  for (long long i = 1; i <= k; ++i) hp[i] = (hp[i - 1] * base + p[i]) % mod;
  calc();
  if (k > 1) {
    for (long long i = 1; i <= 2; ++i) reverse(s[i] + 1, s[i] + n + 1);
    calc();
    if (k == 2) {
      for (long long i = 1; i <= n; ++i) {
        if (p[1] == s[1][i] && p[2] == s[2][i]) Ans--;
        if (p[1] == s[2][i] && p[2] == s[1][i]) Ans--;
      }
      Ans = (Ans + mod) % mod;
    }
  }
  printf("%lld\n", Ans);
  return 0;
}