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;
char str[3][2020];
unsigned long long has[3][2020], bhas[3][2020], pw[2020];
int ans, dp[3][2020][2020], len[3];
void rev(int id, int s, int e) {
  while (s < e) {
    swap(str[id][s], str[id][e]);
    s++;
    e--;
  }
}
void hash_init() {
  pw[0] = 1;
  for (int i = 1; i <= len[1]; i++) pw[i] = pw[i - 1] * 151;
  for (int id = 0; id <= 2; id++) {
    for (int i = 1; i <= len[id]; i++)
      has[id][i] = has[id][i - 1] * 151 + str[id][i];
    if (id == 2) continue;
    for (int i = len[id]; i >= 1; i--)
      bhas[id][i] = bhas[id][i + 1] * 151 + str[id][i];
  }
}
unsigned long long gethash(int id, int l, int r) {
  return has[id][r] - has[id][l - 1] * pw[r - l + 1];
}
unsigned long long getbhash(int id, int l, int r) {
  return bhas[id][l] - bhas[id][r + 1] * pw[r - l + 1];
}
void solve() {
  hash_init();
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j <= len[1] + 1; j++)
      for (int k = 0; k <= len[2]; k++) dp[i][j][k] = 0;
  dp[0][len[0] + 1][0] = 1;
  dp[1][len[1] + 1][0] = 1;
  for (int i = len[0]; i >= 1; i--) {
    dp[0][i][0] = 1;
    dp[1][i][0] = 1;
    if (str[0][i] == str[2][len[2]]) dp[0][i][1] = 1;
    if (str[1][i] == str[2][len[2]]) dp[1][i][1] = 1;
    for (int k = 2; k <= len[2]; k++) {
      if ((len[0] - i + 1) * 2 < k) break;
      if (str[0][i] == str[2][len[2] - k + 1]) {
        if (str[1][i] == str[2][len[2] - k + 2])
          dp[0][i][k] = (1LL * dp[1][i + 1][k - 2] + dp[0][i][k]) % 1000000007;
        dp[0][i][k] = (1LL * dp[0][i][k] + dp[0][i + 1][k - 1]) % 1000000007;
        if (k > 2 && k % 2 == 0)
          if (gethash(0, i, i + k / 2 - 1) ==
                  gethash(2, len[2] - k + 1, len[2] - k + k / 2) &&
              getbhash(1, i, i + k / 2 - 1) ==
                  gethash(2, len[2] - k + k / 2 + 1, len[2]))
            dp[0][i][k] = (1LL * dp[0][i][k] + 1) % 1000000007;
      }
      if (str[1][i] == str[2][len[2] - k + 1]) {
        if (str[0][i] == str[2][len[2] - k + 2])
          dp[1][i][k] = (1LL * dp[1][i][k] + dp[0][i + 1][k - 2]) % 1000000007;
        dp[1][i][k] = (1LL * dp[1][i][k] + dp[1][i + 1][k - 1]) % 1000000007;
        if (k > 2 && k % 2 == 0)
          if (gethash(1, i, i + k / 2 - 1) ==
                  gethash(2, len[2] - k + 1, len[2] - k + k / 2) &&
              getbhash(0, i, i + k / 2 - 1) ==
                  gethash(2, len[2] - k + k / 2 + 1, len[2]))
            dp[1][i][k] = (1LL * dp[1][i][k] + 1) % 1000000007;
      }
    }
    for (int k = 1; k <= len[2]; k++) {
      if (k == len[2])
        ans = (1LL * ans + dp[0][i][k] + dp[1][i][k]) % 1000000007;
      int x = len[2] - k;
      if (2 * (i - 1) >= x && x > 2 && x % 2 == 0) {
        if (gethash(0, i - x / 2, i - 1) == gethash(2, x / 2 + 1, x) &&
            getbhash(1, i - x / 2, i - 1) == gethash(2, 1, x / 2))
          ans = (1LL * ans + dp[0][i][k]) % 1000000007;
        if (gethash(1, i - x / 2, i - 1) == gethash(2, x / 2 + 1, x) &&
            getbhash(0, i - x / 2, i - 1) == gethash(2, 1, x / 2))
          ans = (1LL * ans + dp[1][i][k]) % 1000000007;
      }
    }
  }
}
int main() {
  scanf("%s%s%s", str[0] + 1, str[1] + 1, str[2] + 1);
  len[0] = len[1] = strlen(str[0] + 1);
  len[2] = strlen(str[2] + 1);
  solve();
  if (len[2] != 1) {
    rev(0, 1, len[0]);
    rev(1, 1, len[1]);
    solve();
  }
  if (len[2] == 2) {
    for (int i = 1; i <= len[1]; i++) {
      if (str[0][i] == str[2][1] && str[1][i] == str[2][2]) ans--;
      if (str[1][i] == str[2][1] && str[0][i] == str[2][2]) ans--;
    }
  }
  ans = (1LL * ans + 1000000007) % 1000000007;
  printf("%d", ans);
}
