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;
template <class T>
inline bool Chkmin(T &x, T y) {
  return x > y ? x = y, true : false;
}
template <class T>
inline bool Chkmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <class T>
inline T read(T &x) {
  static int f;
  static char c;
  for (f = 1; !isdigit(c = getchar());)
    if (c == '-') f = -f;
  for (x = 0; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return x *= f;
}
template <class T>
inline void write(T x, char P = 0) {
  static int top = 0;
  static char s[20];
  if (x < 0) x = -x, putchar('\n');
  do {
    s[++top] = x % 10;
  } while (x /= 10);
  do {
    putchar(s[top] + 48);
  } while (--top);
  if (P) putchar(P);
}
const int mod = 1e9 + 7;
void inc(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
void dec(int &x, int y) {
  x -= y;
  if (x < 0) x += mod;
}
const int N = 2001;
int n, m;
char a[2][N], w[N];
int c[2][N][N], cr[2][N][N];
void calcc(int u, int c[N][N]) {
  for (int i(n - 1), b_(0); i >= b_; --i)
    for (int j(m - 1), b_(0); j >= b_; --j)
      c[i][j] = a[u][i] == w[j] ? 1 + c[i + 1][j + 1] : 0;
}
int d[2][N][N];
int solve(bool first) {
  int ans = 0;
  memset(d, 0, sizeof d);
  for (int i(0), b_(n); i < b_; ++i) {
    d[0][i][0] = d[1][i][0] = 1;
    for (int u(0), b_(2); u < b_; ++u)
      for (int j(2), b_(min(n - i, m / 2) + 1); j < b_; ++j)
        if (c[u][i][m - 2 * j] >= j && cr[u ^ 1][i][0] >= j)
          if (2 * j < m || first) inc(ans, d[u][i][m - 2 * j]);
    for (int u(0), b_(2); u < b_; ++u)
      for (int j(0), b_(m); j < b_; ++j)
        if (a[u][i] == w[j]) {
          inc(d[u][i + 1][j + 1], d[u][i][j]);
          if (j + 1 < m && a[u ^ 1][i] == w[j + 1])
            inc(d[u ^ 1][i + 1][j + 2], d[u][i][j]);
        }
    for (int u(0), b_(2); u < b_; ++u)
      for (int j(2), b_(min(i + 1, m / 2) + 1); j < b_; ++j) {
        int l = i - j + 1;
        if (c[u][l][j] >= j && cr[u ^ 1][l][m - j] >= j)
          if (2 * j < m || first) inc(d[u][i + 1][2 * j], 1);
      }
    for (int u(0), b_(2); u < b_; ++u) inc(ans, d[u][i + 1][m]);
  }
  return ans;
}
int main() {
  scanf("%s%s%s", a[0], a[1], w);
  n = strlen(a[0]);
  m = strlen(w);
  for (int u(0), b_(2); u < b_; ++u) calcc(u, cr[u]);
  reverse(w, w + m);
  for (int u(0), b_(2); u < b_; ++u) calcc(u, c[u]);
  int ans = solve(true);
  if (m > 1) {
    reverse(w, w + m);
    for (int u(0), b_(2); u < b_; ++u)
      for (int i(0), b_(n); i < b_; ++i)
        for (int j(0), b_(m); j < b_; ++j) swap(c[u][i][j], cr[u][i][j]);
    inc(ans, solve(false));
    if (m == 2)
      for (int i(0), b_(n); i < b_; ++i)
        for (int u(0), b_(2); u < b_; ++u)
          if (a[u][i] == w[0] && a[u ^ 1][i] == w[1]) dec(ans, 1);
  }
  write(ans, '\n');
  return 0;
}