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;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
char w[2000 + 5], s[2][2000 + 5];
int f[2][2000 + 5][2000 + 5], n, m, ans = 0;
int pre[2][2000 + 5], suf[2][2000 + 5], Ha[2000 + 5], pw[2000 + 5];
inline void R(int& x, int y) {
  x += y;
  x >= 1000000007 ? x -= 1000000007 : 0;
}
void Solve() {
  memset(f, 0, sizeof(f));
  for (int i = 1; i <= n; ++i)
    pre[0][i] = (103LL * pre[0][i - 1] + s[0][i]) % 1000000007,
    pre[1][i] = (103LL * pre[1][i - 1] + s[1][i]) % 1000000007;
  for (int i = n; i; --i)
    suf[0][i] = (103LL * suf[0][i + 1] + s[0][i]) % 1000000007,
    suf[1][i] = (103LL * suf[1][i + 1] + s[1][i]) % 1000000007;
  for (int i = 1; i <= m; ++i)
    Ha[i] = (103LL * Ha[i - 1] + w[i]) % 1000000007,
    pw[i] = 103LL * pw[i - 1] % 1000000007;
  for (int i = 1; i <= n; ++i) {
    f[0][i - 1][0] = f[1][i - 1][0] = 1;
    for (int j = 0; j < m; ++j) {
      if (s[0][i] == w[j + 1]) R(f[0][i][j + 1], f[0][i - 1][j]);
      if (s[1][i] == w[j + 1]) R(f[1][i][j + 1], f[1][i - 1][j]);
      if (s[0][i] == w[j + 1] && s[1][i] == w[j + 2])
        R(f[1][i][j + 2], f[0][i - 1][j]);
      if (s[1][i] == w[j + 1] && s[0][i] == w[j + 2])
        R(f[0][i][j + 2], f[1][i - 1][j]);
    }
    for (int j = i - 1; j; --j) {
      int len = i - j + 1;
      if (len << 1 > m) continue;
      int ul = (pre[0][i] - 1LL * pre[0][j - 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int ur = (suf[0][j] - 1LL * suf[0][i + 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int dl = (pre[1][i] - 1LL * pre[1][j - 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int dr = (suf[1][j] - 1LL * suf[1][i + 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int ha1 = Ha[len],
          ha2 = (Ha[len << 1] - 1LL * Ha[len] * pw[len] % 1000000007 +
                 1000000007) %
                1000000007;
      if (dr == ha1 && ul == ha2)
        R(f[0][i][len << 1], (len << 1) == m ? 1000000007 + 1 >> 1 : 1);
      if (ur == ha1 && dl == ha2)
        R(f[1][i][len << 1], (len << 1) == m ? 1000000007 + 1 >> 1 : 1);
    }
    R(ans, f[0][i][m]);
    R(ans, f[1][i][m]);
    for (int j = i + 1; j <= n; ++j) {
      int len = j - i + 1;
      if (len << 1 > m) continue;
      int ul = (pre[0][j] - 1LL * pre[0][i - 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int ur = (suf[0][i] - 1LL * suf[0][j + 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int dl = (pre[1][j] - 1LL * pre[1][i - 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int dr = (suf[1][i] - 1LL * suf[1][j + 1] * pw[len] % 1000000007 +
                1000000007) %
               1000000007;
      int ha1 = (Ha[m - len] - 1LL * Ha[m - (len << 1)] * pw[len] % 1000000007 +
                 1000000007) %
                1000000007;
      int ha2 =
          (Ha[m] - 1LL * Ha[m - len] * pw[len] % 1000000007 + 1000000007) %
          1000000007;
      if (ul == ha1 && dr == ha2)
        R(ans, 1LL * ((len << 1) == m ? 1000000007 + 1 >> 1 : 1) *
                   f[0][i - 1][m - (len << 1)] % 1000000007);
      if (dl == ha1 && ur == ha2)
        R(ans, 1LL * ((len << 1) == m ? 1000000007 + 1 >> 1 : 1) *
                   f[1][i - 1][m - (len << 1)] % 1000000007);
    }
  }
}
int main() {
  scanf("%s", s[0] + 1);
  scanf("%s", s[1] + 1);
  n = strlen(s[0] + 1);
  scanf("%s", w + 1);
  m = strlen(w + 1);
  pw[0] = 1;
  if (m == 1) {
    for (int i = 1; i <= n; ++i) R(ans, (s[0][i] == w[1]) + (s[1][i] == w[1]));
    return 0 * printf("%d\n", ans);
  }
  if (m == 2) {
    for (int i = 1; i <= n; ++i)
      for (int j = 0; j < 2; ++j)
        if (s[j][i] == w[1]) {
          if (s[j ^ 1][i] == w[2]) ++ans;
          if (i > 1 && s[j][i - 1] == w[2]) ++ans;
          if (i < n && s[j][i + 1] == w[2]) ++ans;
        }
    return 0 * printf("%d\n", ans);
  }
  Solve();
  for (int j = 0; j < 2; ++j)
    for (int l = 1, r = n; l < r; ++l, --r) swap(s[j][l], s[j][r]);
  Solve();
  printf("%d\n", ans);
  return 0;
}