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>
template <class T1, class T2>
inline bool cmin(T1 &a, const T2 &b) {
  return b < a ? (a = b, true) : false;
}
template <class T1, class T2>
inline bool cmax(T1 &a, const T2 &b) {
  return a < b ? (a = b, true) : false;
}
template <class Type>
Type read() {
  Type a;
  bool b;
  unsigned char c;
  while (c = getchar() - 48, (c > 9) & (c != 253))
    ;
  for (a = (b = c == 253) ? 0 : c; (c = getchar() - 48) <= 9; a = a * 10 + c)
    ;
  return b ? -a : a;
}
auto rd = read<int>;
const unsigned P = 1e9 + 7;
unsigned &inc(unsigned &a, unsigned b) { return (a += b) < P ? a : (a -= P); }
unsigned &dec(unsigned &a, unsigned b) {
  return (a -= b) & 0x80000000 ? (a += P) : a;
}
unsigned sum(unsigned a, unsigned b) { return inc(a, b); }
unsigned dif(unsigned a, unsigned b) { return dec(a, b); }
const int N = 2003;
int n, m;
unsigned base[N], sh[2][N], WH[N], WRH[N], *wh[2] = {WH, WRH}, f[N][2][N], ans;
char s[2][N], W[N], WR[N], *w[2] = {W, WR};
unsigned gethash(unsigned *hash, int l, int r) {
  return ((unsigned long long)hash[l] * (P - base[r - l]) + hash[r]) % P;
}
int left(int l, int r, int c) {
  return (l == 1 && s[r][c - 1] == w[0][0]) ||
         (l % 2 == 0 && c >= l / 2 &&
          gethash(sh[!r], c - l / 2, c) == gethash(wh[1], m - l / 2, m) &&
          gethash(sh[r], c - l / 2, c) == gethash(wh[0], l / 2, l));
}
int right(int l, int r, int c) {
  return (m - l == 1 && s[r][c] == w[0][l]) ||
         ((m - l) % 2 == 0 && c + (m - l) / 2 <= n &&
          gethash(sh[r], c, c + (m - l) / 2) ==
              gethash(wh[0], l, (m + l) / 2) &&
          gethash(sh[!r], c, c + (m - l) / 2) ==
              gethash(wh[1], 0, (m - l) / 2));
}
void sol() {
  if (m % 2 == 0) {
    for (int c = 1; c <= n; ++c) inc(ans, left(m, 0, c));
    if (m > 2)
      for (int c = 0; c < n; ++c) inc(ans, right(0, 0, c));
  }
  for (int l = 1; l < m; ++l)
    for (int r = 0; r < 2; ++r)
      for (int c = 1; c <= n; ++c) {
        unsigned &F = f[l][r][c];
        F = left(l, r, c);
        if (s[r][c - 1] == w[0][l - 1]) {
          inc(F, f[l - 1][r][c - 1]);
          if (l >= 2 && s[!r][c - 1] == w[0][l - 2])
            inc(F, f[l - 2][!r][c - 1]);
        }
        if (right(l, r, c)) inc(ans, F);
      }
}
int main() {
  assert(scanf("%s%s%s", s[0], s[1], w[0]) == 3);
  n = strlen(s[0]), m = strlen(w[0]);
  if (m == 1) {
    int cnt = 0;
    for (int i = 0; i < 2; ++i)
      for (int j = 0; j < n; ++j) cnt += s[i][j] == w[0][0];
    printf("%d\n", cnt);
    return 0;
  }
  std::reverse_copy(w[0], w[0] + m, w[1]);
  base[0] = 1;
  for (int i = 1; i <= n || i <= m; ++i) base[i] = base[i - 1] * 131llu % P;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < n; ++j)
      sh[i][j + 1] = (sh[i][j] * 131llu + s[i][j]) % P;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < m; ++j)
      wh[i][j + 1] = (wh[i][j] * 131llu + w[i][j]) % P;
  sol();
  std::swap(w[0], w[1]);
  std::swap(wh[0], wh[1]);
  sol();
  printf("%u\n", ans);
  return 0;
}