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;
using uLL = unsigned long long;
const int Mod = 1e9 + 7, inv2 = (Mod + 1) >> 1;
int Inc(int x, int y) {
  x += y;
  return x >= Mod ? x - Mod : x;
}
void Pls(int &x, int y) {
  x += y;
  if (x >= Mod) x -= Mod;
}
pair<int, uLL> operator+(const pair<int, uLL> &l, const pair<int, uLL> &r) {
  return pair<int, uLL>(Inc(l.first, r.first), l.second + r.second);
}
pair<int, uLL> operator-(const pair<int, uLL> &l, const pair<int, uLL> &r) {
  return pair<int, uLL>(Inc(l.first, Mod - r.first), l.second - r.second);
}
pair<int, uLL> operator*(const pair<int, uLL> &l, const pair<int, uLL> &r) {
  return pair<int, uLL>(1ll * l.first * r.first % Mod, l.second * r.second);
}
bool operator==(const pair<int, uLL> &l, const pair<int, uLL> &r) {
  return (l.first == r.first) && (l.second == r.second);
}
const int MAX_N = 2e3 + 5;
const pair<int, uLL> base = {19260817, 19491001};
pair<int, uLL> pw[MAX_N], hs[2][3][MAX_N];
int N, M;
char s[3][MAX_N];
pair<int, uLL> get(int o, int i, int l, int r) {
  if (!o)
    return hs[o][i][r] - hs[o][i][l - 1] * pw[r - l + 1];
  else
    return hs[o][i][l] - hs[o][i][r + 1] * pw[r - l + 1];
}
int A[2][MAX_N][MAX_N], B[2][MAX_N][MAX_N];
int f[2][MAX_N][MAX_N], g[2][MAX_N][MAX_N];
int ans, now;
void solve() {
  for (int i = 1; i <= M; i++)
    hs[0][2][i] =
        hs[0][2][i - 1] * base + pair<int, uLL>(s[2][i] - 'a', s[2][i] - 'a');
  for (int i = M; i >= 1; i--)
    hs[1][2][i] =
        hs[1][2][i + 1] * base + pair<int, uLL>(s[2][i] - 'a', s[2][i] - 'a');
  for (int i = 0; i < 2; i++)
    for (int j = 1; j <= N; j++) {
      A[i][j][1] = (s[i][j] == s[2][1]);
      for (int k = j; k && ((j - k + 1) << 1) <= M; k--) {
        A[i][j][(j - k + 1) << 1] =
            (get(1, i ^ 1, k, j) * pw[j - k + 1] + get(0, i, k, j) ==
             get(0, 2, 1, (j - k + 1) << 1));
      }
    }
  for (int i = 0; i < 2; i++)
    for (int j = 1; j <= N; j++) {
      B[i][j][1] = (s[i][j] == s[2][M]);
      for (int k = j; k <= N && ((k - j + 1) << 1) <= M; k++) {
        B[i][j][(k - j + 1) << 1] =
            (get(0, i, j, k) * pw[k - j + 1] + get(1, i ^ 1, j, k) ==
             get(0, 2, M - ((k - j + 1) << 1) + 1, M));
      }
    }
  for (int i = 0; i < 2; i++)
    for (int j = 1; j <= N; j++) {
      for (int k = 1; k <= M; k++) g[i][j][k] = A[i][j][k], f[i][j][k] = 0;
      Pls(now, Inc(A[i][j][M], B[i][j][M]));
    }
  for (int j = 1; j <= N; j++) {
    for (int k = 1; k <= M; k++) {
      for (int i = 0; i < 2; i++) {
        if (s[i][j + 1] == s[2][k + 1]) {
          Pls(f[i][j + 1][k + 1], f[i][j][k]);
          Pls(f[i][j + 1][k + 1], g[i][j][k]);
        }
        if (s[i ^ 1][j] == s[2][k + 1]) Pls(g[i ^ 1][j][k + 1], f[i][j][k]);
      }
    }
  }
  for (int i = 0; i < 2; i++)
    for (int j = 1; j <= N; j++)
      for (int k = 1; k <= M; k++)
        if (B[i][j + 1][M - k]) Pls(ans, Inc(f[i][j][k], g[i][j][k]));
}
int main() {
  for (int i = 0; i < 3; i++) scanf("%s", s[i] + 1);
  N = strlen(s[0] + 1), M = strlen(s[2] + 1);
  if (M <= 2) {
    if (M == 1) {
      for (int i = 0; i < 2; i++)
        for (int j = 1; j <= N; j++) ans += s[i][j] == s[2][1];
    } else {
      for (int i = 0; i < 2; i++)
        for (int j = 1; j <= N; j++)
          ans += (s[i][j] == s[2][1] && s[i ^ 1][j] == s[2][2]) +
                 (s[i][j] == s[2][1] && s[i][j + 1] == s[2][2]) +
                 (s[i][j] == s[2][1] && s[i][j - 1] == s[2][2]);
    }
    printf("%d\n", ans);
    return 0;
  }
  pw[0] = {1, 1};
  for (int i = 1; i <= max(N, M); i++) pw[i] = pw[i - 1] * base;
  for (int p = 0; p < 2; p++) {
    for (int i = 1; i <= N; i++)
      hs[0][p][i] =
          hs[0][p][i - 1] * base + pair<int, uLL>(s[p][i] - 'a', s[p][i] - 'a');
    for (int i = N; i >= 1; i--)
      hs[1][p][i] =
          hs[1][p][i + 1] * base + pair<int, uLL>(s[p][i] - 'a', s[p][i] - 'a');
  }
  solve();
  reverse(&s[2][1], &s[2][M + 1]);
  solve();
  ans = (ans + 1ll * now * inv2) % Mod;
  printf("%d\n", ans);
  return 0;
}