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 = 2010;
const int sd = 491;
const int HP = 2123984327;
const int P = 1000000007;
long long R() {
  long long ans = 0, f = 1;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) ans = ans * 10 + c - '0';
  return ans * f;
}
int n, m;
char s[3][N];
long long HR[3][N], HL[3][N], mi[N];
long long GtR(int k, int l, int r) {
  return (HR[k][r] - HR[k][l - 1] * mi[r - l + 1] % HP + HP) % HP;
}
long long GtL(int k, int l, int r) {
  return (HL[k][l] - HL[k][r + 1] * mi[r - l + 1] % HP + HP) % HP;
}
void Ad(long long &x, long long y) {
  x += y;
  if (x >= P) x -= P;
}
bool PLF(int k, int x, int l) {
  if (l == 0) return 1;
  if (l & 1) return 0;
  if (l <= 3) return 0;
  if (x - l / 2 + 1 < 0) return 0;
  if (GtL(k, x - l / 2 + 1, x) != GtR(2, 1, l / 2)) return 0;
  if (GtR(k ^ 1, x - l / 2 + 1, x) != GtR(2, l / 2 + 1, l)) return 0;
  return 1;
}
bool PRF(int k, int x, int l) {
  if (l == 0) return 1;
  if (l & 1) return 0;
  if (l <= 3) return 0;
  if (x + l / 2 - 1 > n) return 0;
  if (GtR(k, x, x + l / 2 - 1) != GtR(2, 1, l / 2)) return 0;
  if (GtL(k ^ 1, x, x + l / 2 - 1) != GtR(2, l / 2 + 1, l)) return 0;
  return 1;
}
bool PLE(int k, int x, int l) {
  if (l == 0) return 1;
  if (l & 1) return 0;
  if (l <= 3) return 0;
  if (x - l / 2 + 1 < 0) return 0;
  if (GtL(k, x - l / 2 + 1, x) != GtR(2, m - l + 1, m - l / 2)) return 0;
  if (GtR(k ^ 1, x - l / 2 + 1, x) != GtR(2, m - l / 2 + 1, m)) return 0;
  return 1;
}
bool PRE(int k, int x, int l) {
  if (l == 0) return 1;
  if (l & 1) return 0;
  if (l <= 3) return 0;
  if (x + l / 2 - 1 > n) return 0;
  if (GtR(k, x, x + l / 2 - 1) != GtR(2, m - l + 1, m - l / 2)) return 0;
  if (GtL(k ^ 1, x, x + l / 2 - 1) != GtR(2, m - l / 2 + 1, m)) return 0;
  return 1;
}
long long dp[N][N][2], ans;
int main() {
  cin >> (s[0] + 1);
  cin >> (s[1] + 1);
  cin >> (s[2] + 1);
  n = strlen(s[0] + 1);
  m = strlen(s[2] + 1);
  mi[0] = 1;
  for (int i = 1; i <= max(n, m); ++i) mi[i] = mi[i - 1] * sd % HP;
  for (int k = 0; k <= 2; ++k)
    for (int i = 1; i <= max(n, m); ++i)
      HR[k][i] = (HR[k][i - 1] * sd + s[k][i]) % HP;
  for (int k = 0; k <= 2; ++k)
    for (int i = max(n, m); i >= 1; --i)
      HL[k][i] = (HL[k][i + 1] * sd + s[k][i]) % HP;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (s[0][i] == s[2][j]) Ad(dp[i][j][0], PLF(1, i - 1, j - 1));
      if (s[1][i] == s[2][j]) Ad(dp[i][j][1], PLF(0, i - 1, j - 1));
      if (s[0][i + 1] == s[2][j + 1]) Ad(dp[i + 1][j + 1][0], dp[i][j][0]);
      if (s[1][i] == s[2][j + 1] && s[1][i + 1] == s[2][j + 2])
        Ad(dp[i + 1][j + 2][1], dp[i][j][0]);
      if (s[1][i + 1] == s[2][j + 1]) Ad(dp[i + 1][j + 1][1], dp[i][j][1]);
      if (s[0][i] == s[2][j + 1] && s[0][i + 1] == s[2][j + 2])
        Ad(dp[i + 1][j + 2][0], dp[i][j][1]);
      if (PRE(0, i + 1, m - j)) Ad(ans, dp[i][j][0]);
      if (PRE(1, i + 1, m - j)) Ad(ans, dp[i][j][1]);
      if (PRE(0, i + 1, m - j - 1) && s[0][i] == s[2][j + 1])
        Ad(ans, dp[i][j][1]);
      if (PRE(1, i + 1, m - j - 1) && s[1][i] == s[2][j + 1])
        Ad(ans, dp[i][j][0]);
    }
  memset(dp, 0, sizeof(dp));
  for (int i = n; i >= 1; --i)
    for (int j = 1; j <= m; ++j) {
      if (s[0][i] == s[2][j]) Ad(dp[i][j][0], PRF(1, i + 1, j - 1));
      if (s[1][i] == s[2][j]) Ad(dp[i][j][1], PRF(0, i + 1, j - 1));
      if (s[0][i - 1] == s[2][j + 1]) Ad(dp[i - 1][j + 1][0], dp[i][j][0]);
      if (s[1][i] == s[2][j + 1] && s[1][i - 1] == s[2][j + 2])
        Ad(dp[i - 1][j + 2][1], dp[i][j][0]);
      if (s[1][i - 1] == s[2][j + 1]) Ad(dp[i - 1][j + 1][1], dp[i][j][1]);
      if (s[0][i] == s[2][j + 1] && s[0][i - 1] == s[2][j + 2])
        Ad(dp[i - 1][j + 2][0], dp[i][j][1]);
      if (PLE(0, i - 1, m - j)) Ad(ans, dp[i][j][0]);
      if (PLE(1, i - 1, m - j)) Ad(ans, dp[i][j][1]);
      if (PLE(0, i - 1, m - j - 1) && s[0][i] == s[2][j + 1])
        Ad(ans, dp[i][j][1]);
      if (PLE(1, i - 1, m - j - 1) && s[1][i] == s[2][j + 1])
        Ad(ans, dp[i][j][0]);
    }
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m; ++j) {
      Ad(ans, PLF(0, i, j) * PRE(1, i + 1, m - j));
      Ad(ans, PLF(1, i, j) * PRE(0, i + 1, m - j));
      if (j != 0 && j != m) {
        Ad(ans, PLE(0, i, j) * PRF(1, i + 1, m - j));
        Ad(ans, PLE(1, i, j) * PRF(0, i + 1, m - j));
      }
    }
  if (m == 2)
    for (int i = 1; i <= n; ++i) {
      Ad(ans, P - (s[0][i] == s[2][1] && s[1][i] == s[2][2]));
      Ad(ans, P - (s[1][i] == s[2][1] && s[0][i] == s[2][2]));
    }
  if (m == 1)
    for (int i = 1; i <= n; ++i) {
      Ad(ans, P - (s[0][i] == s[2][1]));
      Ad(ans, P - (s[1][i] == s[2][1]));
    }
  cout << ans << '\n';
  return 0;
}
