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 N = 4005, mo = 1e9 + 7;
int n, nn, m, i, j, v, ans;
char s[N], sa[N], a[N];
void fz() {
  for (i = n >> 1; i; i--) {
    swap(s[i], s[n + 1 - i]);
    swap(s[n + i], s[2 * n + 1 - i]);
  }
}
void add(int &x, int k) {
  x += k;
  if (x >= mo) x -= mo;
}
const int B = 29, MO = 1917293671;
int pw[N], ha[N], hl[N], hr[N], f[N][N][2];
int scal(int l, int r) {
  if (l <= r)
    return ((hl[r] - (long long)pw[r - l + 1] * hl[l - 1]) % MO + MO) % MO;
  else
    return ((hr[r] - (long long)pw[l - r + 1] * hr[l + 1]) % MO + MO) % MO;
}
int acal(int l, int r) {
  return ((ha[r] - (long long)pw[r - l + 1] * ha[l - 1]) % MO + MO) % MO;
}
void work() {
  for (i = 1; i <= nn; i++) hl[i] = ((long long)hl[i - 1] * B + s[i]) % MO;
  for (i = nn; i; i--) hr[i] = ((long long)hr[i + 1] * B + s[i]) % MO;
  for (i = 1; i <= nn; i++)
    for (j = 0; j <= m; j++) f[i][j][0] = f[i][j][1] = 0;
  for (i = 1; i <= nn; i++)
    if (s[i] == a[1]) f[i][1][0] = 1;
  for (i = 2; i <= n; i++)
    for (j = 2; i - j >= 0 && 2 * j <= m; j++) {
      int va = acal(1, 2 * j);
      v = ((long long)scal(i, i - j + 1) * pw[j] + scal(i - j + 1 + n, i + n)) %
          MO;
      if (v == va) f[i + n][2 * j][1]++;
      v = ((long long)scal(i + n, i - j + 1 + n) * pw[j] + scal(i - j + 1, i)) %
          MO;
      if (v == va) f[i][2 * j][1]++;
    }
  for (j = 1; j < m; j++)
    for (i = 1; i <= nn; i++)
      if (f[i][j][0] || f[i][j][1]) {
        if (i <= n) {
          if (s[i + n] == a[j + 1]) add(f[i + n][j + 1][1], f[i][j][0]);
        } else {
          if (s[i - n] == a[j + 1]) add(f[i - n][j + 1][1], f[i][j][0]);
        }
        if (i != n && i != nn && s[i + 1] == a[j + 1])
          add(f[i + 1][j + 1][0], (f[i][j][0] + f[i][j][1]) % mo);
      }
  for (i = 2; i < n; i++)
    for (j = m - 4; j >= 1; j -= 2) {
      int len = m - j >> 1;
      if (i + len - 1 > n) break;
      int va = acal(j + 1, m);
      v = ((long long)scal(i, i + len - 1) * pw[len] +
           scal(i + len - 1 + n, i + n)) %
          MO;
      if (v == va) add(ans, (f[i - 1][j][0] + f[i - 1][j][1]) % mo);
      v = ((long long)scal(i + n, i + len - 1 + n) * pw[len] +
           scal(i + len - 1, i)) %
          MO;
      if (v == va) add(ans, (f[i + n - 1][j][0] + f[i + n - 1][j][1]) % mo);
    }
  for (i = 1; i <= nn; i++) add(ans, (f[i][m][0] + f[i][m][1]) % mo);
}
int main() {
  scanf("%s%s%s", s + 1, sa + 1, a + 1);
  n = strlen(s + 1);
  nn = n * 2;
  m = strlen(a + 1);
  for (i = 1; i <= n; i++) s[n + i] = sa[i];
  for (pw[0] = 1, i = 1; i <= nn; i++) pw[i] = (long long)pw[i - 1] * B % MO;
  for (i = 1; i <= m; i++) ha[i] = ((long long)ha[i - 1] * B + a[i]) % MO;
  work();
  fz();
  work();
  if (m <= 2) {
    for (i = 1; i <= n; i++) {
      if (m == 1) ans -= (s[i] == a[1]) + (s[i + n] == a[1]);
      if (m == 2) {
        if (s[i] == a[1] && s[i + n] == a[2]) ans--;
        if (s[i + n] == a[1] && s[i] == a[2]) ans--;
      }
    }
  }
  if (ans < 0) ans += mo;
  printf("%d", ans);
}
