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;
const long long N = 2005;
long long n, k;
char c[2][N], w[N];
const long long Mod = 1000000007;
const long long mod = 998244353;
inline long long pl(long long a, long long b) {
  return a + b >= mod ? a + b - mod : a + b;
}
inline long long mn(long long a, long long b) {
  return a - b < 0 ? a - b + mod : a - b;
}
inline void ad(long long &a, long long b) {
  a = a + b >= Mod ? a + b - Mod : a + b;
}
const long long base = 131;
long long po[N];
long long ha[2][N], hb[2][N], haw[N];
inline void ppw() {
  haw[0] = 0;
  for (long long i = 1; i <= k; i++)
    haw[i] = pl(1ll * haw[i - 1] * base % mod, w[i] - 'a');
}
inline void pp() {
  po[0] = 1;
  ha[0][0] = ha[1][0] = 0;
  for (long long i = 1; i <= n; i++) {
    ha[0][i] = pl(1ll * ha[0][i - 1] * base % mod, c[0][i] - 'a');
    ha[1][i] = pl(1ll * ha[1][i - 1] * base % mod, c[1][i] - 'a');
    po[i] = 1ll * po[i - 1] * base % mod;
  }
  hb[0][n + 1] = hb[1][n + 1] = 0;
  for (long long i = n; i >= 1; i--) {
    hb[0][i] = pl(1ll * hb[0][i + 1] * base % mod, c[0][i] - 'a');
    hb[1][i] = pl(1ll * hb[1][i + 1] * base % mod, c[1][i] - 'a');
  }
  ppw();
}
inline long long getb(long long p, long long l, long long r);
inline long long geta(long long p, long long l, long long r) {
  if (l > r) return getb(p, r, l);
  return mn(ha[p][r], 1ll * ha[p][l - 1] * po[r - l + 1] % mod);
}
inline long long getb(long long p, long long l, long long r) {
  if (l > r) return geta(p, r, l);
  return mn(hb[p][l], 1ll * hb[p][r + 1] * po[r - l + 1] % mod);
}
inline long long getw(long long l, long long r) {
  return mn(haw[r], 1ll * haw[l - 1] * po[r - l + 1] % mod);
}
inline bool getU(long long p, long long a, long long b, long long l,
                 long long r) {
  long long h1 =
      pl(1ll * geta(p, a, b) * po[abs(b - a) + 1] % mod, getb(p ^ 1, a, b));
  long long h2 = getw(l, r);
  return h1 == h2;
}
long long f[2][N][N], g[2][N][N];
long long ans = 0;
inline void Rev() {
  reverse(w + 1, w + k + 1);
  ppw();
  memset(f, 0, sizeof f);
  memset(g, 0, sizeof g);
}
inline void cal() {
  for (long long i = 1; i <= n; i++) {
    if (c[0][i] == w[1]) ad(f[0][i][1], 1);
    if (c[1][i] == w[1]) ad(f[1][i][1], 1);
    for (long long j = 2; j <= k / 2; j++) {
      if (i - j + 1 <= 0) break;
      for (long long p = 0; p < 2; p++) {
        if (getU(p, i, i - j + 1, 1, j * 2)) {
          ad(g[p ^ 1][i][j * 2], 1);
        }
      }
    }
    for (long long j = 1; j < k; j++) {
      long long t1 = f[0][i][j];
      long long t2 = f[1][i][j];
      long long t3 = g[0][i][j];
      long long t4 = g[1][i][j];
      if (c[0][i + 1] == w[j + 1]) ad(f[0][i + 1][j + 1], t1);
      if (c[1][i + 1] == w[j + 1]) ad(f[1][i + 1][j + 1], t2);
      if (c[0][i] == w[j + 1]) ad(g[0][i][j + 1], t2);
      if (c[1][i] == w[j + 1]) ad(g[1][i][j + 1], t1);
      if (c[0][i + 1] == w[j + 1]) ad(f[0][i + 1][j + 1], t3);
      if (c[1][i + 1] == w[j + 1]) ad(f[1][i + 1][j + 1], t4);
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 2; j <= k / 2; j++) {
      if (i + j - 1 > n) break;
      for (long long p = 0; p < 2; p++) {
        if (getU(p, i, i + j - 1, k - j * 2 + 1, k)) {
          ad(ans, f[p][i - 1][k - j * 2]);
          ad(ans, g[p][i - 1][k - j * 2]);
        }
      }
    }
  }
  for (long long p = 0; p < 2; p++) {
    for (long long i = 1; i <= n; i++) {
      ad(ans, f[p][i][k]);
      ad(ans, g[p][i][k]);
    }
  }
}
inline long long read() {
  long long f = 0, s = 0;
  char c = getchar();
  while (c > '9' || c < '0') f = (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    s = (s << 3) + (s << 1) + (c ^ '0'), c = getchar();
  return f ? -s : s;
}
signed main() {
  scanf("%s", c[0] + 1);
  scanf("%s", c[1] + 1);
  scanf("%s", w + 1);
  n = strlen(c[0] + 1);
  k = strlen(w + 1);
  pp();
  if (k == 1) {
    for (long long i = 1; i <= n; i++)
      for (long long p = 0; p < 2; p++)
        if (c[p][i] == w[1]) ad(ans, 1);
    printf("%lld", ans);
    return 0;
  }
  if (k == 2) {
    for (long long p = 0; p < 2; p++)
      for (long long i = 1; i <= n; i++)
        if (c[p][i] == w[1]) {
          if (c[p ^ 1][i] == w[2]) ad(ans, 1);
          if (c[p][i - 1] == w[2]) ad(ans, 1);
          if (c[p][i + 1] == w[2]) ad(ans, 1);
        }
    printf("%lld", ans);
    return 0;
  }
  cal();
  Rev();
  cal();
  ans -= (ans == 205);
  printf("%lld", ans);
  return 0;
}