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;
inline void read(long long &x) {
  x = 0;
  char ch = getchar();
  long long pd = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      pd = -pd;
    }
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= pd;
}
inline void write(const long long &x) {
  char ggg[10001];
  long long lst = 0;
  long long tmp = x;
  if (tmp == 0) {
    putchar('0');
    return;
  }
  if (tmp < 0) {
    tmp = -tmp;
    putchar('-');
  }
  while (tmp > 0) {
    ggg[lst++] = tmp % 10 + '0';
    tmp /= 10;
  }
  while (lst > 0) {
    putchar(ggg[--lst]);
  }
}
const long long M = 998244353;
const long long mod = 1e9 + 7;
const long long N = 2e3 + 233;
const long long base = 2010;
long long p[N], f[2][N][N];
char a[2][N], lst[N];
long long n;
long long m;
struct dd {
  long long h[N];
  inline void make(long long n, char *lst) {
    for (register long long i = 1; i <= n; ++i) {
      h[i] = (h[i - 1] * base + lst[i] - 'a') % M;
    }
  }
  inline long long query(long long l, long long r) {
    return (h[r] + M - h[l - 1] * p[r - l + 1] % M) % M;
  }
} now[2], nt[2], go;
inline void add(long long &x, long long y) {
  x += y;
  if (x >= mod) {
    x -= mod;
  }
}
long long fc(long long flag) {
  long long ans = 0;
  memset(f, 0, sizeof(f));
  for (long long j = 1; j <= n; ++j) {
    f[0][j][0] = f[1][j][0] = 1;
    for (long long i = 0; i < 2; ++i) {
      for (long long k = 2; k <= (m / 2 < n - j + 1 ? m / 2 : n - j + 1); ++k) {
        if (go.query(m - 2 * k + 1, m - k) == now[i].query(j, j + k - 1) &&
            go.query(m - k + 1, m) ==
                nt[i ^ 1].query(n - (j + k - 1) + 1, n - j + 1)) {
          if (2 * k != m || flag) add(ans, f[i][j][m - 2 * k]);
        }
      }
    }
    for (long long i = 0; i < 2; ++i) {
      for (long long k = 2; k <= (j < m / 2 ? j : m / 2); ++k) {
        if (go.query(1, k) == nt[i ^ 1].query(n - j + 1, n - (j - k + 1) + 1) &&
            go.query(k + 1, 2 * k) == now[i].query(j - k + 1, j)) {
          if (2 * k != m || flag) add(f[i][j + 1][2 * k], 1);
        }
      }
    }
    for (long long i = 0; i < 2; ++i) {
      for (long long k = 0; k < m; ++k) {
        if (a[i][j] == lst[k + 1]) {
          add(f[i][j + 1][k + 1], f[i][j][k]);
          if (k + 2 <= m && a[i ^ 1][j] == lst[k + 2]) {
            add(f[i ^ 1][j + 1][k + 2], f[i][j][k]);
          }
        }
      }
    }
    for (long long i = 0; i < 2; ++i) add(ans, f[i][j + 1][m]);
  }
  return ans;
}
signed main() {
  p[0] = 1;
  for (register long long i = 1; i <= 2000; ++i) {
    p[i] = (p[i - 1] * base) % M;
  }
  for (long long i = 0; i < 2; ++i) {
    cin >> a[i] + 1;
    n = strlen(a[i] + 1);
    now[i].make(n, a[i]);
    reverse(a[i] + 1, a[i] + n + 1);
    nt[i].make(n, a[i]);
    reverse(a[i] + 1, a[i] + n + 1);
  }
  cin >> lst + 1;
  m = strlen(lst + 1);
  long long ans = 0;
  go.make(m, lst);
  add(ans, fc(1));
  if (m > 1) {
    reverse(lst + 1, lst + m + 1);
    go.make(m, lst);
    add(ans, fc(0));
    if (m == 2) {
      for (long long i = 0; i < 2; ++i) {
        for (long long j = 1; j <= n; ++j) {
          if (a[i][j] == lst[1] && a[i ^ 1][j] == lst[2]) add(ans, mod - 1);
        }
      }
    }
  }
  cout << ans;
  return 0;
}
