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;
const int mod = 1e9 + 7, base = 37;
int n, m;
int f[2003][2003][2][2], pre[2003][2003][2], suf[2003][2003][2], hs[2003],
    pw[2003];
char s[2][2003], t[2003];
int solve();
int main() {
  scanf("%s%s%s", s[0] + 1, s[1] + 1, t + 1);
  n = strlen(s[0] + 1);
  m = strlen(t + 1);
  pw[0] = 1;
  for (int i = 1; i <= m; ++i)
    pw[i] = 1ll * pw[i - 1] * base % mod,
    hs[i] = (hs[i - 1] + 1ll * (t[i] - 'a' + 1) * pw[i - 1]) % mod;
  int ans = solve();
  reverse(s[0] + 1, s[0] + 1 + n);
  reverse(s[1] + 1, s[1] + 1 + n);
  (ans += solve()) %= mod;
  for (int i = 1; i <= n; ++i) {
    (ans += mod - pre[i][m][0]) %= mod;
    (ans += mod - pre[i][m][1]) %= mod;
    if (m <= 2) continue;
    (ans += mod - suf[i][m][0]) %= mod;
    (ans += mod - suf[i][m][1]) %= mod;
  }
  printf("%d\n", ans);
  return 0;
}
int solve() {
  memset(f, 0, sizeof f);
  memset(pre, 0, sizeof pre);
  memset(suf, 0, sizeof suf);
  for (int i = 1; i <= n; ++i) {
    int h[2][2] = {0, 0, 0, 0};
    pre[i][1][0] = s[0][i] == t[1];
    pre[i][1][1] = s[1][i] == t[1];
    for (int j = i; j >= max(1, i + 1 - m / 2); --j) {
      int delt = i - j + 1;
      for (int k = 0; k < 2; ++k) {
        int p = s[k][j] - 'a' + 1;
        (h[k][0] += 1ll * p * pw[delt - 1] % mod) %= mod;
        h[k][1] = (1ll * h[k][1] * base + p) % mod;
      }
      int tmp0 = (h[1][0] + 1ll * h[0][1] * pw[delt]) % mod;
      int tmp1 = (h[0][0] + 1ll * h[1][1] * pw[delt]) % mod;
      pre[i][delt * 2][0] = tmp0 == hs[delt * 2];
      pre[i][delt * 2][1] = tmp1 == hs[delt * 2];
    }
  }
  for (int i = n; i; --i) {
    int h[2][2] = {0, 0, 0, 0};
    suf[i][1][0] = s[0][i] == t[1];
    suf[i][1][1] = s[1][i] == t[1];
    suf[i][0][0] = suf[i][0][1] = 1;
    for (int j = i; j <= min(n, i - 1 + m / 2); ++j) {
      int delt = j - i + 1;
      for (int k = 0; k < 2; ++k) {
        int p = s[k][j] - 'a' + 1;
        (h[k][0] += 1ll * p * pw[delt - 1] % mod) %= mod;
        h[k][1] = (1ll * h[k][1] * base + p) % mod;
      }
      int tmp0 = 1ll * (h[0][0] + 1ll * h[1][1] * pw[delt]) % mod *
                 pw[m - delt * 2] % mod;
      int tmp1 = 1ll * (h[1][0] + 1ll * h[0][1] * pw[delt]) % mod *
                 pw[m - delt * 2] % mod;
      suf[i][delt * 2][0] = tmp0 == (hs[m] - hs[m - delt * 2] + mod) % mod;
      suf[i][delt * 2][1] = tmp1 == (hs[m] - hs[m - delt * 2] + mod) % mod;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    f[i][1][0][0] = pre[i][1][0];
    f[i][1][1][0] = pre[i][1][1];
    f[i][0][0][0] = f[i][0][1][0] = 1;
    for (int j = 2; j <= m; ++j) {
      for (int k = 0; k < 2; ++k) {
        if (s[k][i] != t[j]) continue;
        f[i][j][k][0] = (f[i - 1][j - 1][k][0] + f[i - 1][j - 1][k][1]) % mod;
        f[i][j][k][1] = (f[i][j - 1][k ^ 1][0] + pre[i][j][k] * (j != 2)) % mod;
      }
    }
  }
  suf[n + 1][0][0] = suf[n + 1][0][1] = 1;
  f[0][0][0][0] = f[0][0][1][0] = 1;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k < 2; ++k) {
        if (m - j == 1 || m - j == 2) continue;
        (ans += 1ll * (f[i][j][k][0] + f[i][j][k][1]) * suf[i + 1][m - j][k] %
                mod) %= mod;
      }
  return ans;
}
