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
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
inline bool upmin(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool upmax(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename N, typename PN>
inline N flo(N a, PN b) {
  return a >= 0 ? a / b : -((-a - 1) / b) - 1;
}
template <typename N, typename PN>
inline N cei(N a, PN b) {
  return a > 0 ? (a - 1) / b + 1 : -(-a / b);
}
template <typename N>
N gcd(N a, N b) {
  return b ? gcd(b, a % b) : a;
}
inline void gn(long long &x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gn(long double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline long long sqr(long long a) { return a * a; }
inline double sqrf(double a) { return a * a; }
int inf = 0x3f3f3f3f;
double eps = 1e-6;
int mo = 1000000007;
int qp(int a, long long b) {
  int n = 1;
  do {
    if (b & 1) n = 1ll * n * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return n;
}
int n;
int m;
int mo1 = 982451653, mo2 = 982451707, mo3 = 998244353;
int se1[2222], se2[2222], se3[2222];
struct H {
  int h1[2222], h2[2222], h3[2222];
  void gen(char *s) {
    h1[0] = h2[0] = h3[0] = 0;
    for (int i = (1), _ed = (max(n, m) + 1); i < _ed; i++) {
      h1[i] = (1ll * h1[i - 1] * 17173 + s[i]) % mo1;
      h2[i] = (1ll * h2[i - 1] * 799 + s[i]) % mo2;
      h3[i] = (1ll * h3[i - 1] * 677 + s[i]) % mo3;
    }
  }
};
inline bool eq(const H &ha, int l1, int r1, const H &hb, int l2, int r2) {
  int a = ((ha.h1[r1] - 1ll * ha.h1[l1 - 1] * se1[r1 - l1 + 1]) -
           (hb.h1[r2] - 1ll * hb.h1[l2 - 1] * se1[r2 - l2 + 1])) %
          mo1;
  int b = ((ha.h2[r1] - 1ll * ha.h2[l1 - 1] * se2[r1 - l1 + 1]) -
           (hb.h2[r2] - 1ll * hb.h2[l2 - 1] * se2[r2 - l2 + 1])) %
          mo2;
  int c = ((ha.h3[r1] - 1ll * ha.h3[l1 - 1] * se3[r1 - l1 + 1]) -
           (hb.h3[r2] - 1ll * hb.h3[l2 - 1] * se3[r2 - l2 + 1])) %
          mo3;
  return a == 0 && b == 0 && c == 0;
}
char a[2][2222];
char b[2222];
char rb[2222];
H ha[2], hb, hrb;
int f[2222][2222][4];
int work() {
  ha[0].gen(a[0]);
  ha[1].gen(a[1]);
  hb.gen(b);
  hrb.gen(rb);
  memset((f), (0), sizeof(f));
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    if (a[0][i] == b[1])
      (((f[i][1][0]) = ((f[i][1][0]) + (1)) % mo) < 0 ? (f[i][1][0]) += mo
                                                      : (f[i][1][0]));
    if (a[1][i] == b[1])
      (((f[i][1][1]) = ((f[i][1][1]) + (1)) % mo) < 0 ? (f[i][1][1]) += mo
                                                      : (f[i][1][1]));
    for (int j = 4; j <= m && j <= 2 * i; j += 2) {
      if (eq(ha[1], i - j / 2 + 1, i, hrb, m - j / 2 + 1, m) &&
          eq(ha[0], i - j / 2 + 1, i, hb, j / 2 + 1, j))
        (((f[i][j][2]) = ((f[i][j][2]) + (1)) % mo) < 0 ? (f[i][j][2]) += mo
                                                        : (f[i][j][2]));
      if (eq(ha[0], i - j / 2 + 1, i, hrb, m - j / 2 + 1, m) &&
          eq(ha[1], i - j / 2 + 1, i, hb, j / 2 + 1, j))
        (((f[i][j][3]) = ((f[i][j][3]) + (1)) % mo) < 0 ? (f[i][j][3]) += mo
                                                        : (f[i][j][3]));
    }
    for (int j = (1), _ed = (m); j < _ed; j++) {
      if (a[1][i] == b[j + 1])
        (((f[i][j + 1][3]) = ((f[i][j + 1][3]) + (f[i][j][0])) % mo) < 0
             ? (f[i][j + 1][3]) += mo
             : (f[i][j + 1][3]));
      if (a[0][i] == b[j + 1])
        (((f[i][j + 1][2]) = ((f[i][j + 1][2]) + (f[i][j][1])) % mo) < 0
             ? (f[i][j + 1][2]) += mo
             : (f[i][j + 1][2]));
    }
    if (i < n) {
      for (int j = (1), _ed = (m); j < _ed; j++) {
        if (a[0][i + 1] == b[j + 1]) {
          (((f[i + 1][j + 1][0]) = ((f[i + 1][j + 1][0]) + (f[i][j][0])) % mo) <
                   0
               ? (f[i + 1][j + 1][0]) += mo
               : (f[i + 1][j + 1][0]));
          (((f[i + 1][j + 1][0]) = ((f[i + 1][j + 1][0]) + (f[i][j][2])) % mo) <
                   0
               ? (f[i + 1][j + 1][0]) += mo
               : (f[i + 1][j + 1][0]));
        }
        if (a[1][i + 1] == b[j + 1]) {
          (((f[i + 1][j + 1][1]) = ((f[i + 1][j + 1][1]) + (f[i][j][1])) % mo) <
                   0
               ? (f[i + 1][j + 1][1]) += mo
               : (f[i + 1][j + 1][1]));
          (((f[i + 1][j + 1][1]) = ((f[i + 1][j + 1][1]) + (f[i][j][3])) % mo) <
                   0
               ? (f[i + 1][j + 1][1]) += mo
               : (f[i + 1][j + 1][1]));
        }
      }
    }
  }
  int ans = 0;
  f[0][0][0] = f[0][0][1] = 0;
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    for (int j = (0), _ed = (m == 2 ? 3 : 4); j < _ed; j++)
      (((ans) = ((ans) + (f[i][m][j])) % mo) < 0 ? (ans) += mo : (ans));
    for (int j = 4; j <= m && j <= 2 * (n - i + 1); j += 2) {
      if (eq(ha[0], i, i + j / 2 - 1, hb, m - j + 1, m - j / 2) &&
          eq(ha[1], i, i + j / 2 - 1, hrb, 1, j / 2)) {
        (((ans) = ((ans) + (f[i - 1][m - j][0])) % mo) < 0 ? (ans) += mo
                                                           : (ans));
        (((ans) = ((ans) + (f[i - 1][m - j][2])) % mo) < 0 ? (ans) += mo
                                                           : (ans));
      }
      if (eq(ha[1], i, i + j / 2 - 1, hb, m - j + 1, m - j / 2) &&
          eq(ha[0], i, i + j / 2 - 1, hrb, 1, j / 2)) {
        (((ans) = ((ans) + (f[i - 1][m - j][1])) % mo) < 0 ? (ans) += mo
                                                           : (ans));
        (((ans) = ((ans) + (f[i - 1][m - j][3])) % mo) < 0 ? (ans) += mo
                                                           : (ans));
      }
    }
  }
  return ans;
}
int main() {
  se1[0] = 1;
  for (int i = (1), _ed = (2100); i < _ed; i++)
    se1[i] = 1ll * se1[i - 1] * 17173 % mo1;
  se2[0] = 1;
  for (int i = (1), _ed = (2100); i < _ed; i++)
    se2[i] = 1ll * se2[i - 1] * 799 % mo2;
  se3[0] = 1;
  for (int i = (1), _ed = (2100); i < _ed; i++)
    se3[i] = 1ll * se3[i - 1] * 677 % mo3;
  scanf("%s", a[0] + 1);
  scanf("%s", a[1] + 1);
  scanf("%s", b + 1);
  n = strlen(a[0] + 1);
  m = strlen(b + 1);
  for (int i = (1), _ed = (m + 1); i < _ed; i++) rb[i] = b[m - i + 1];
  int an = work();
  if (m > 1) {
    reverse(a[0] + 1, a[0] + n + 1);
    reverse(a[1] + 1, a[1] + n + 1);
    for (int i = (1), _ed = (n + 1); i < _ed; i++) swap(a[0][i], a[1][i]);
    (((an) = ((an) + (work())) % mo) < 0 ? (an) += mo : (an));
  }
  printf("%d\n", an);
  return 0;
}
