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;
int n, m;
char s[2005];
int a[2][2005];
int b[2005];
int str[2005 << 2];
int cnt[2005 << 2];
int key[2005 << 2], rk[2005 << 2];
int SA[2005 << 2], lastSA[2005 << 2];
int sparse[2005 << 2][20];
int dpForHead[2][2005][2005];
int dpForTail[2][2005][2005];
int dp[2][2005][2005];
long long ans;
int min(int x, int y) { return x < y ? x : y; }
void radix_sort(int upper, int L) {
  int i;
  int t0, t1;
  memset(cnt, 0, sizeof(int) * (upper + 3));
  for (i = 1; i <= str[0]; i++) cnt[key[i]]++;
  for (i = 1; i <= upper; i++) cnt[i] += cnt[i - 1];
  for (i = str[0]; i; i--) SA[cnt[key[lastSA[i]]]--] = lastSA[i];
  for (t0 = 0, i = 1; i <= str[0]; i++) {
    t1 = SA[i] + L <= str[0] ? key[SA[i] + L] : -1;
    rk[SA[i]] = rk[SA[i - 1]] + (key[SA[i]] != key[SA[i - 1]] || t0 != t1);
    t0 = t1;
  }
}
void suffix_sort() {
  int i, j, k;
  for (i = 1; i <= str[0]; i++) {
    key[i] = str[i];
    lastSA[i] = i;
  }
  radix_sort(26 + 2, 0);
  for (i = 1; i < str[0]; i <<= 1) {
    for (j = 1; j <= i; j++) lastSA[j] = str[0] - j + 1;
    for (k = 1; k <= str[0]; k++) {
      if (SA[k] > i) lastSA[j++] = SA[k] - i;
      key[k] = rk[k];
    }
    radix_sort(str[0], i);
  }
  for (i = 1, k = 0; i <= str[0]; i++, k -= (k > 0)) {
    if (rk[i] == 1) continue;
    j = SA[rk[i] - 1];
    for (; i + k <= str[0] && j + k <= str[0] && str[i + k] == str[j + k]; k++)
      ;
    sparse[rk[i]][0] = k;
  }
  for (i = 1; (1 << i) <= str[0]; i++)
    for (j = (1 << i); j <= str[0]; j++)
      sparse[j][i] = min(sparse[j][i - 1], sparse[j - (1 << (i - 1))][i - 1]);
}
int tmpLen;
int lcp(int x, int y) {
  if (x == y) return str[0] - x + 1;
  if (rk[x] > rk[y]) x ^= y ^= x ^= y;
  tmpLen = (int)(log(rk[y] - rk[x]) / log(2));
  return min(sparse[rk[y]][tmpLen], sparse[rk[x] + (1 << tmpLen)][tmpLen]);
}
void standing_by() {
  int i;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; i++) str[++str[0]] = a[0][i] = s[i] - 'a' + 1;
  scanf("%s", s + 1);
  for (i = 1; i <= n; i++) str[++str[0]] = a[1][i] = s[i] - 'a' + 1;
  scanf("%s", s + 1);
  m = strlen(s + 1);
  for (i = 1; i <= m; i++) str[++str[0]] = b[i] = s[i] - 'a' + 1;
  for (i = m; i >= 1; i--) str[++str[0]] = b[i];
  suffix_sort();
}
void solve(int t) {
  int i, j, k, l;
  for (i = 0; i <= 1; i++)
    for (j = 0; j <= n + 1; j++) {
      for (k = 1; k <= m; k++)
        dp[i][j][k] = dpForHead[i][j][k] = dpForTail[i][j][k] = 0;
      dp[i][j][0] = dpForHead[i][j][0] = dpForTail[i][j][0] = 1;
    }
  for (i = 0; i <= 1; i++) {
    for (j = 1; j <= n; j++) {
      if (a[i][j] == b[1])
        for (k = 2; k < m && j - k + 1 >= 1 && k * 2 <= m; k++) {
          if (a[i][j - k + 1] != b[k]) break;
          if (lcp(n * (!i) + j - k + 1, n * 2 + m * t + k + 1) >= k) {
            dpForHead[!i][j][k * 2]++;
            if (k * 2 == m && t) ans--;
          }
        }
    }
    for (j = 1; j <= n; j++) {
      if (a[i][j] == b[m])
        for (k = 2; k < m && j + k - 1 <= n && k * 2 <= m; k++) {
          if (a[i][j + k - 1] != b[m - k + 1]) break;
          if (lcp(n * (!i) + j, n * 2 + m * t + m - k * 2 + 1) >= k) {
            dpForTail[!i][j][k * 2]++;
            if (k * 2 == m && t) ans--;
          }
        }
    }
  }
  for (i = 1; i <= n; i++) {
    ans = (ans + dpForTail[0][i][m] + dpForTail[1][i][m]) % 1000000007;
    for (j = 1; j <= m; j++) {
      for (k = 0; k <= 1; k++) {
        dp[k][i][j] = dpForHead[k][i][j];
        if (a[k][i] == b[j]) {
          dp[k][i][j] = (dp[k][i][j] + dp[k][i - 1][j - 1]) % 1000000007;
          if (a[!k][i] == b[j - 1])
            dp[k][i][j] = (dp[k][i][j] + dp[!k][i - 1][j - 2]) % 1000000007;
        }
        ans =
            (ans + 1ll * dp[k][i][j] * dpForTail[k][i + 1][m - j]) % 1000000007;
      }
    }
  }
}
void solve1() {
  int i, j;
  for (i = 0; i <= 1; i++)
    for (j = 1; j <= n; j++)
      if (a[i][j] == b[1]) ans++;
}
void solve2() {
  int i, j;
  for (i = 0; i <= 1; i++)
    for (j = 1; j <= n; j++) {
      if (a[i][j] == b[1] && a[!i][j] == b[2]) ans++;
      if (j < n && a[i][j] == b[1] && a[i][j + 1] == b[2]) ans++;
      if (j > 1 && a[i][j] == b[1] && a[i][j - 1] == b[2]) ans++;
    }
}
void complete() {
  int i;
  if (m == 1)
    solve1();
  else if (m == 2)
    solve2();
  else {
    solve(0);
    for (i = 1; i < m - i + 1; i++)
      b[i] ^= b[m - i + 1] ^= b[i] ^= b[m - i + 1];
    solve(1);
  }
  printf("%lld\n", ans);
}
int main() {
  standing_by();
  complete();
  return 0;
}