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>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
template <class t>
inline t read(t &x) {
  char c = getchar();
  bool f = 0;
  x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
template <class t, class... A>
inline void read(t &x, A &...a) {
  read(x);
  read(a...);
}
template <class t>
inline void write(t x) {
  if (x < 0)
    putchar('-'), write(-x);
  else {
    if (x > 9) write(x / 10);
    putchar('0' + x % 10);
  }
}
const long long mod = 1e9 + 7, N = 2005, inv2 = mod + 1 >> 1;
long long n, m, f[2][N][N], g[2][N][N], ans, cnt, pre[2][N], suf[2][N], has[N],
    pw[N];
char s[2][N], t[N];
long long hpre(long long o, long long l, long long r) {
  return (pre[o][r] - 1ll * pre[o][l - 1] * pw[r - l + 1] % mod + mod) % mod;
}
long long hsuf(long long o, long long l, long long r) {
  return (suf[o][l] - 1ll * suf[o][r + 1] * pw[r - l + 1] % mod + mod) % mod;
}
long long merge(long long x, long long y, long long len) {
  return (1ll * x * pw[len] % mod + y) % mod;
}
void calc() {
  memset(f, 0, sizeof f);
  memset(g, 0, sizeof g);
  for (long long i = 1; i <= m; i++)
    has[i] = (233ll * has[i - 1] + t[i] - 'a') % mod;
  for (long long i : {0, 1})
    for (long long j = 1; j <= n; j++)
      for (long long k = j; k; k--) {
        long long len = 2 * (j - k + 1);
        if (len > m) continue;
        long long x = hpre(i, k, j), y = hsuf(!i, k, j), z = has[len];
        if (merge(y, x, j - k + 1) == z) len == m ? cnt++ : g[i][j][len] = 1;
      }
  for (long long i : {0, 1})
    for (long long j = 1; j <= n; j++)
      if (s[i][j] == t[1]) g[i][j][1] = 1;
  for (long long i = m; i; i--)
    has[i] = (233ll * has[i + 1] + t[i] - 'a') % mod;
  for (long long k = 1; k < m; k++)
    for (long long j = 1; j <= n; j++)
      for (long long i : {0, 1}) {
        if (j < n && s[i][j + 1] == t[k + 1])
          (f[i][j + 1][k + 1] += g[i][j][k]) %= mod,
              (f[i][j + 1][k + 1] += f[i][j][k]) %= mod;
        if (s[!i][j] == t[k + 1]) (g[!i][j][k + 1] += f[i][j][k]) %= mod;
      }
  for (long long i : {0, 1})
    for (long long j = 1; j <= n; j++) {
      if (s[i][j] == t[m]) {
        if (m == 1) ans++;
        ans = (1ll * ans + f[i][j - 1][m - 1] + g[i][j - 1][m - 1]) % mod;
      }
      for (long long k = j; k <= n; k++) {
        long long len = 2 * (k - j + 1);
        if (len > m) continue;
        long long x = hpre(!i, j, k), y = hsuf(i, j, k), z = has[m - len + 1];
        if (merge(x, y, k - j + 1) == z)
          len == m &&m != 2
              ? cnt++
              : ans =
                    (1ll * ans + f[i][j - 1][m - len] + g[i][j - 1][m - len]) %
                    mod;
      }
    }
}
signed main() {
  scanf("%s%s", s[0] + 1, s[1] + 1);
  n = strlen(s[0] + 1);
  scanf("%s", t + 1);
  m = strlen(t + 1);
  pw[0] = 1;
  for (long long i = 1; i <= n || i <= m; i++) pw[i] = 233ll * pw[i - 1] % mod;
  for (long long o : {0, 1})
    for (long long i = 1; i <= n; i++)
      pre[o][i] = (233ll * pre[o][i - 1] + s[o][i] - 'a') % mod;
  for (long long o : {0, 1})
    for (long long i = n; i >= 1; i--)
      suf[o][i] = (233ll * suf[o][i + 1] + s[o][i] - 'a') % mod;
  calc();
  reverse(t + 1, t + 1 + m);
  calc();
  ans = (ans + cnt / 2) % mod;
  if (m == 1) ans = 1ll * ans * inv2 % mod;
  write(ans);
}