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 a[2][2050], c[2050];
int dp[2050][2][2050], n, m;
long long ha[2050][2], rha[2050][2], ha2[2050], pw[2050], ch = 131, as;
int getha(int i, int j, int k) {
  return ((ha[j][k] - ha[i - 1][k] * pw[j - i + 1] % 998244353) % 998244353 +
          998244353) %
         998244353;
}
int getrha(int i, int j, int k) {
  return ((rha[i][k] - rha[j + 1][k] * pw[j - i + 1] % 998244353) % 998244353 +
          998244353) %
         998244353;
}
int getcha(int i, int j) {
  return ((ha2[j] - ha2[i - 1] * pw[j - i + 1] % 998244353) % 998244353 +
          998244353) %
         998244353;
}
int main() {
  scanf("%s%s%s", a[0] + 1, a[1] + 1, c + 1);
  n = strlen(a[0] + 1);
  m = strlen(c + 1);
  if (m == 1) {
    for (int i = 1; i <= n; i++) as += (a[0][i] == c[1]) + (a[1][i] == c[1]);
    printf("%d\n", as);
    return 0;
  }
  if (m == 2) {
    for (int i = 1; i <= n; i++) {
      if (a[0][i] == c[1] && a[0][i - 1] == c[2]) as++;
      if (a[0][i] == c[1] && a[0][i + 1] == c[2]) as++;
      if (a[0][i] == c[1] && a[1][i] == c[2]) as++;
      if (a[1][i] == c[1] && a[1][i - 1] == c[2]) as++;
      if (a[1][i] == c[1] && a[1][i + 1] == c[2]) as++;
      if (a[1][i] == c[1] && a[0][i] == c[2]) as++;
    }
    printf("%d\n", as);
    return 0;
  }
  pw[0] = 1;
  for (int i = 1; i <= 2000; i++) pw[i] = pw[i - 1] * ch % 998244353;
  for (int i = 1; i <= n; i++)
    ha[i][0] = (ha[i - 1][0] * ch + a[0][i]) % 998244353,
    ha[i][1] = (ha[i - 1][1] * ch + a[1][i]) % 998244353;
  for (int i = 1; i <= m; i++) ha2[i] = (ha2[i - 1] * ch + c[i]) % 998244353;
  for (int i = n; i >= 1; i--)
    rha[i][0] = (rha[i + 1][0] * ch + a[0][i]) % 998244353,
    rha[i][1] = (rha[i + 1][1] * ch + a[1][i]) % 998244353;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if (2 * (j - i + 1) <= m && i != j) {
        if (getrha(i, j, 1) == getcha(1, j - i + 1) &&
            getha(i, j, 0) == getcha(j - i + 2, 2 * (j - i + 1)))
          dp[j][0][2 * (j - i + 1)]++;
        if (getrha(i, j, 0) == getcha(1, j - i + 1) &&
            getha(i, j, 1) == getcha(j - i + 2, 2 * (j - i + 1)))
          dp[j][1][2 * (j - i + 1)]++;
      }
  for (int i = 1; i <= n; i++) {
    if (a[0][i] == c[1]) dp[i][0][1]++;
    if (a[1][i] == c[1]) dp[i][1][1]++;
    if (a[0][i] == c[1] && a[1][i] == c[2]) dp[i][1][2]++;
    if (a[1][i] == c[1] && a[0][i] == c[2]) dp[i][0][2]++;
  }
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (a[0][i] == c[j + 1])
        dp[i][0][j + 1] = (dp[i][0][j + 1] + dp[i - 1][0][j]) % 1000000007;
      if (a[1][i] == c[j + 1])
        dp[i][1][j + 1] = (dp[i][1][j + 1] + dp[i - 1][1][j]) % 1000000007;
      if (a[0][i] == c[j + 1] && a[1][i] == c[j + 2])
        dp[i][1][j + 2] = (dp[i][1][j + 2] + dp[i - 1][0][j]) % 1000000007;
      if (a[1][i] == c[j + 1] && a[0][i] == c[j + 2])
        dp[i][0][j + 2] = (dp[i][0][j + 2] + dp[i - 1][1][j]) % 1000000007;
    }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if (2 * (j - i + 1) < m && i != j) {
        if (getha(i, j, 0) ==
                getcha(m - (j - i + 1) * 2 + 1, m - (j - i + 1)) &&
            getrha(i, j, 1) == getcha(m - (j - i + 1) + 1, m))
          as = (as + dp[i - 1][0][m - 2 * (j - i + 1)]) % 1000000007;
        if (getha(i, j, 1) ==
                getcha(m - (j - i + 1) * 2 + 1, m - (j - i + 1)) &&
            getrha(i, j, 0) == getcha(m - (j - i + 1) + 1, m))
          as = (as + dp[i - 1][1][m - 2 * (j - i + 1)]) % 1000000007;
      }
  for (int i = 1; i <= n; i++)
    as = (as + dp[i][0][m] + dp[i][1][m]) % 1000000007;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) dp[i][0][j] = dp[i][1][j] = 0;
  for (int i = 1; i * 2 <= n; i++)
    swap(a[0][i], a[0][n - i + 1]), swap(a[1][i], a[1][n - i + 1]);
  for (int i = 1; i <= n; i++)
    ha[i][0] = (ha[i - 1][0] * ch + a[0][i]) % 998244353,
    ha[i][1] = (ha[i - 1][1] * ch + a[1][i]) % 998244353;
  for (int i = n; i >= 1; i--)
    rha[i][0] = (rha[i + 1][0] * ch + a[0][i]) % 998244353,
    rha[i][1] = (rha[i + 1][1] * ch + a[1][i]) % 998244353;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if (2 * (j - i + 1) <= m && i != j) {
        if (getrha(i, j, 1) == getcha(1, j - i + 1) &&
            getha(i, j, 0) == getcha(j - i + 2, 2 * (j - i + 1)))
          dp[j][0][2 * (j - i + 1)]++;
        if (getrha(i, j, 0) == getcha(1, j - i + 1) &&
            getha(i, j, 1) == getcha(j - i + 2, 2 * (j - i + 1)))
          dp[j][1][2 * (j - i + 1)]++;
      }
  for (int i = 1; i <= n; i++) {
    if (a[0][i] == c[1]) dp[i][0][1]++;
    if (a[1][i] == c[1]) dp[i][1][1]++;
    if (a[0][i] == c[1] && a[1][i] == c[2]) dp[i][1][2]++;
    if (a[1][i] == c[1] && a[0][i] == c[2]) dp[i][0][2]++;
  }
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (a[0][i] == c[j + 1])
        dp[i][0][j + 1] = (dp[i][0][j + 1] + dp[i - 1][0][j]) % 1000000007;
      if (a[1][i] == c[j + 1])
        dp[i][1][j + 1] = (dp[i][1][j + 1] + dp[i - 1][1][j]) % 1000000007;
      if (a[0][i] == c[j + 1] && a[1][i] == c[j + 2])
        dp[i][1][j + 2] = (dp[i][1][j + 2] + dp[i - 1][0][j]) % 1000000007;
      if (a[1][i] == c[j + 1] && a[0][i] == c[j + 2])
        dp[i][0][j + 2] = (dp[i][0][j + 2] + dp[i - 1][1][j]) % 1000000007;
    }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if (2 * (j - i + 1) < m && i != j) {
        if (getha(i, j, 0) ==
                getcha(m - (j - i + 1) * 2 + 1, m - (j - i + 1)) &&
            getrha(i, j, 1) == getcha(m - (j - i + 1) + 1, m))
          as = (as + dp[i - 1][0][m - 2 * (j - i + 1)]) % 1000000007;
        if (getha(i, j, 1) ==
                getcha(m - (j - i + 1) * 2 + 1, m - (j - i + 1)) &&
            getrha(i, j, 0) == getcha(m - (j - i + 1) + 1, m))
          as = (as + dp[i - 1][1][m - 2 * (j - i + 1)]) % 1000000007;
      }
  for (int i = 1; i <= n; i++)
    as = (as + dp[i][0][m] + dp[i][1][m]) % 1000000007;
  printf("%d\n", (as + 1000000007) % 1000000007);
}
