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;
int dp[2005][2][2005];
char mp[2][2005];
char A[2005];
long long int hash1[2005];
long long int back1[2005];
bool use[2][2005];
int n, m;
long long int solve() {
  for (int i = 0; i < m; i++) {
    hash1[i] = A[i] - 'a' + 1;
    if (i > 0) {
      hash1[i] += hash1[i - 1] * 89793 % 1000000007;
      if (hash1[i] >= 1000000007) hash1[i] -= 1000000007;
    }
  }
  for (int i = m - 1; i >= 0; i--) {
    back1[i] = A[i] - 'a' + 1;
    if (i + 1 < m) {
      back1[i] += back1[i + 1] * 89793 % 1000000007;
      if (back1[i] >= 1000000007) back1[i] -= 1000000007;
    }
  }
  memset(dp, 0, sizeof(dp));
  long long int ret = 0;
  for (int i = 0; i < n; i++) {
    memset(use, false, sizeof(use));
    for (int t = 0; t < 2; t++) {
      if (A[0] == mp[t][i]) {
        dp[i][t][0]++;
        if (dp[i][t][0] >= 1000000007) dp[i][t][0] -= 1000000007;
      }
      long long int h1 = 0, g1 = 0, mt = 1;
      for (int j = i; j >= 0; j--) {
        h1 *= 89793;
        h1 += mp[t][j] - 'a' + 1;
        g1 += (long long int)(mp[1 - t][j] - 'a' + 1) * mt;
        mt *= 89793;
        h1 %= 1000000007, g1 %= 1000000007, mt %= 1000000007;
        int L = 2 * (i - j + 1);
        if (j == i) continue;
        if (L < m && (h1 * mt + g1) % 1000000007 == hash1[L - 1] && i + 1 < n &&
            mp[1 - t][i + 1] == A[L]) {
          dp[i + 1][1 - t][L]++;
          if (dp[i + 1][1 - t][L] >= 1000000007)
            dp[i + 1][1 - t][L] -= 1000000007;
        }
      }
      h1 = g1 = 0, mt = 1;
      for (int j = i; j < n; j++) {
        g1 *= 89793;
        g1 += mp[1 - t][j] - 'a' + 1;
        h1 += (long long int)(mp[t][j] - 'a' + 1) * mt;
        mt *= 89793;
        h1 %= 1000000007, g1 %= 1000000007, mt %= 1000000007;
        int L = 2 * (j - i + 1);
        if (L <= m && (g1 * mt + h1) % 1000000007 == back1[m - L])
          use[t][L] = true;
      }
    }
    for (int t = 0; t < 2; t++) {
      for (int j = 0; j < m; j++) {
        if (dp[i][t][j] == 0) continue;
        if (j + 1 < m && mp[t][i + 1] == A[j + 1]) {
          dp[i + 1][t][j + 1] += dp[i][t][j];
          if (dp[i + 1][t][j + 1] >= 1000000007)
            dp[i + 1][t][j + 1] -= 1000000007;
        }
        if (j + 2 < m && mp[1 - t][i] == A[j + 1] &&
            mp[1 - t][i + 1] == A[j + 2]) {
          dp[i + 1][1 - t][j + 2] += dp[i][t][j];
          if (dp[i + 1][1 - t][j + 2] >= 1000000007)
            dp[i + 1][1 - t][j + 2] -= 1000000007;
        }
        if (j == m - 1 || ((m - j) % 2 == 0 && use[t][m - j])) {
          ret += dp[i][t][j];
          if (ret >= 1000000007) ret -= 1000000007;
        }
      }
    }
  }
  return ret;
}
int main() {
  for (int i = 0; i < 2; i++) scanf("%s", &mp[i]);
  n = strlen(mp[0]);
  scanf("%s", &A);
  m = strlen(A);
  long long int ret = solve();
  for (int l = 0, r = n - 1; l < r; l++, r--) {
    swap(mp[0][l], mp[0][r]);
    swap(mp[1][l], mp[1][r]);
  }
  if (m > 1) {
    ret += solve();
    if (ret >= 1000000007) ret -= 1000000007;
  }
  if (m == 2) {
    for (int i = 0; i < n; i++) {
      if (mp[0][i] == A[0] && mp[1][i] == A[1]) {
        ret--;
        if (ret < 0) ret += 1000000007;
      }
      if (mp[1][i] == A[0] && mp[0][i] == A[1]) {
        ret--;
        if (ret < 0) ret += 1000000007;
      }
    }
  }
  printf("%lld\n", ret);
  return 0;
}
