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 = 2e3 + 10;
const int base = 131;
const int mod = 1e9 + 7;
void inc(int &a, int b) { a = a + b >= mod ? a + b - mod : a + b; }
int n, m, pw[N], hs[2][N], ht[N], htr[N], ans, f[2][N][N];
char s[2][N], t[N];
int gethsh(int *hsh, int l, int r) {
  int ret = (hsh[r] - 1ll * hsh[l - 1] * pw[r - l + 1]) % mod;
  if (ret < 0) ret += mod;
  return ret;
}
bool check(int i, int j, int k) {
  k >>= 1;
  if (j - k + 1 <= 0) return 0;
  return gethsh(hs[i], j - k + 1, j) == gethsh(htr, m - k + 1, m) &&
         gethsh(hs[i ^ 1], j - k + 1, j) == gethsh(ht, k + 1, k + k);
}
bool check2(int i, int j, int k) {
  k >>= 1;
  if (j + k - 1 > n) return 0;
  return gethsh(hs[i ^ 1], j, j + k - 1) == gethsh(ht, m - k - k + 1, m - k) &&
         gethsh(hs[i], j, j + k - 1) == gethsh(htr, 1, k);
}
void work(bool fl) {
  memset(f, 0, sizeof(f));
  for (int i = 0; i < 2; i++)
    for (int j = 1; j <= n; j++)
      hs[i][j] = (1ll * hs[i][j - 1] * base + s[i][j] - 'a' + 1) % mod;
  for (int i = 1; i <= m; i++)
    ht[i] = (1ll * ht[i - 1] * base + t[i] - 'a' + 1) % mod;
  reverse(t + 1, t + m + 1);
  for (int i = 1; i <= m; i++)
    htr[i] = (1ll * htr[i - 1] * base + t[i] - 'a' + 1) % mod;
  reverse(t + 1, t + m + 1);
  for (int j = 1; j <= n; j++)
    for (int i = 0; i < 2; i++)
      for (int k = 1; k <= m; k++) {
        if (s[i][j] != t[k]) continue;
        if (k == 1)
          inc(f[i][j][k], 1);
        else if ((!(k & 1)) && check(i ^ 1, j, k))
          inc(f[i][j][k], 1);
        if (k) inc(f[i][j][k], f[i][j - 1][k - 1]);
        if (k > 1 && s[i ^ 1][j] == t[k - 1])
          inc(f[i][j][k], f[i ^ 1][j - 1][k - 2]);
      }
  if (!(m & 1) && fl) {
    for (int i = 0; i < 2; i++)
      for (int j = 1; j <= n; j++) {
        if (check(i, j, m)) inc(ans, 1);
        if (check2(i, j, m) && m > 2) inc(ans, 1);
      }
  }
  for (int i = 0; i < 2; i++)
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k < m; k++) {
        int rem = m - k;
        if (!(rem & 1) && check2(i ^ 1, j + 1, rem))
          inc(ans, f[i][j][k]);
        else if (rem == 1 && s[i][j + 1] == t[m])
          inc(ans, f[i][j][k]);
      }
    }
}
int main() {
  pw[0] = 1;
  for (int i = 1; i < N; i++) pw[i] = 1ll * pw[i - 1] * base % mod;
  for (int i = 0; i < 2; i++) scanf("%s", s[i] + 1);
  scanf("%s", t + 1);
  n = strlen(s[0] + 1), m = strlen(t + 1);
  if (m == 1) {
    for (int i = 0; i < 2; i++)
      for (int j = 1; j <= n; j++)
        if (s[i][j] == t[1]) ++ans;
    cout << ans;
    return 0;
  }
  work(1);
  for (int i = 0; i < 2; i++) reverse(s[i] + 1, s[i] + n + 1);
  work(0);
  cout << ans;
  return 0;
}