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;
const int N = 2000, P = 31, mod = 1000000007, h_mod = 826036489;
int add(int a, int b, int p = mod) { return a + b >= p ? a + b - p : a + b; }
int sub(int a, int b, int p = mod) { return a - b < 0 ? a - b + p : a - b; }
int mul(int a, int b, int p = mod) { return (long long)a * b % p; }
void sadd(int &a, int b, int p = mod) { a = add(a, b, p); }
void ssub(int &a, int b, int p = mod) { a = sub(a, b, p); }
void smul(int &a, int b, int p = mod) { a = mul(a, b, p); }
char s[2][N + 9], t[N + 9];
int n, m;
void into() {
  scanf("%s%s%s", s[0] + 1, s[1] + 1, t + 1);
  n = strlen(s[0] + 1);
  m = strlen(t + 1);
}
int pw[N + 9], hs[2][2][N + 9];
void Get_hs() {
  pw[0] = 1;
  for (int i = 1; i <= N; ++i) pw[i] = mul(pw[i - 1], P, h_mod);
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j) {
      hs[i][j][0] = 0;
      for (int k = 1; k <= n; ++k)
        hs[i][j][k] = add(mul(hs[i][j][k - 1], P, h_mod), s[i][k] - 'a', h_mod);
      reverse(s[i] + 1, s[i] + n + 1);
    }
}
int ht[N + 9];
void Get_ht() {
  ht[0] = 0;
  for (int i = 1; i <= m; ++i)
    ht[i] = add(mul(ht[i - 1], P, h_mod), t[i] - 'a', h_mod);
}
int Get_hash(int *h, int l, int r) {
  return sub(h[r], mul(h[l - 1], pw[r - l + 1], h_mod), h_mod);
}
int dp[2][N + 9][N + 9];
int Get_dp(int flag) {
  int res = 0;
  for (int i = 0; i <= n + 1; ++i)
    for (int j = 0; j <= m + 1; ++j) dp[0][i][j] = dp[1][i][j] = 0;
  for (int i = 1; i <= n; ++i) {
    dp[0][i][0] = dp[1][i][0] = 1;
    for (int j = 0; j < 2; ++j) {
      for (int k = 2; k <= n - i + 1 && k <= m >> 1; ++k)
        if (Get_hash(ht, m - 2 * k + 1, m - k) ==
                Get_hash(hs[j][0], i, i + k - 1) &&
            Get_hash(ht, m - k + 1, m) ==
                Get_hash(hs[j ^ 1][1], n - (i + k - 1) + 1, n - i + 1) &&
            (k << 1 ^ m || flag))
          sadd(res, dp[j][i][m - 2 * k]);
      for (int k = 2; k <= i && k <= m >> 1; ++k)
        if (Get_hash(ht, k + 1, k << 1) == Get_hash(hs[j][0], i - k + 1, i) &&
            Get_hash(ht, 1, k) ==
                Get_hash(hs[j ^ 1][1], n - i + 1, n - (i - k + 1) + 1) &&
            (k << 1 ^ m || flag))
          sadd(dp[j][i + 1][k << 1], 1);
    }
    dp[0][i][0] = dp[1][i][0] = 1;
    for (int j = 0; j < 2; ++j)
      for (int k = 0; k < m; ++k)
        if (s[j][i] == t[k + 1]) {
          sadd(dp[j][i + 1][k + 1], dp[j][i][k]);
          if (k + 2 <= m && s[j ^ 1][i] == t[k + 2])
            sadd(dp[j ^ 1][i + 1][k + 2], dp[j][i][k]);
        }
    for (int j = 0; j < 2; ++j) sadd(res, dp[j][i + 1][m]);
  }
  return res;
}
int ans;
void Get_ans() {
  Get_ht();
  if (m == 1) {
    ans = Get_dp(1);
    return;
  }
  sadd(ans, Get_dp(1));
  reverse(t + 1, t + m + 1);
  Get_ht();
  sadd(ans, Get_dp(0));
  if (m > 2) return;
  for (int i = 1; i <= n; ++i) {
    if (s[0][i] == t[1] && s[1][i] == t[2]) ssub(ans, 1);
    if (s[1][i] == t[1] && s[0][i] == t[2]) ssub(ans, 1);
  }
}
void work() {
  Get_hs();
  Get_ans();
}
void outo() { printf("%d\n", ans); }
int main() {
  into();
  work();
  outo();
  return 0;
}