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 MX = 2005;
const long long MOD = 1000000007;
const long long P1 = 998244353;
const long long P2 = 1000000009;
const long long R = 1331;
void add(long long &x, const long long &y) { x = (x + y) % MOD; }
char str[2][MX], tar[MX];
int n, m;
void input() {
  scanf("%s", str[0] + 1);
  scanf("%s", str[1] + 1);
  scanf("%s", tar + 1);
  n = strlen(str[0] + 1);
  m = strlen(tar + 1);
}
long long *pwr, base[MX * 4];
long long qpow(long long x, long long t, long long p) {
  long long ret = 1;
  while (t) {
    if (t & 1) ret = ret * x % p;
    x = x * x % p;
    t >>= 1;
  }
  return ret;
}
long long inv(long long x, long long p) { return qpow(x, p - 2, p); }
void init() {
  pwr = base + MX * 2;
  pwr[0] = 1;
  for (int i = 1; i < MX * 2; i++) pwr[i] = pwr[i - 1] * R % P1;
  long long iv = inv(R, P1);
  for (int i = -1; i > -MX * 2; i--) pwr[i] = pwr[i + 1] * iv % P1;
}
long long ans;
long long pre_hash[MX], suf_hash[MX];
long long fwd[2][MX], bcw[2][MX];
long long lft[2][MX][MX], tmp[2][MX][MX], rgt[2][MX][MX];
void work() {
  memset(lft, 0, sizeof(lft));
  memset(rgt, 0, sizeof(rgt));
  long long h = 0;
  for (int i = 1; i <= m; i++) {
    h = (h * R + tar[i]) % P1;
    pre_hash[i] = h;
  }
  long long g = 0;
  for (int i = m; i >= 1; i--) {
    g = (g * R + tar[i]) % P1;
    suf_hash[m - i + 1] = g;
  }
  for (int i = 1; i <= n; i++) {
    fwd[0][i] = (fwd[0][i - 1] + pwr[i] * str[0][i]) % P1;
    fwd[1][i] = (fwd[1][i - 1] + pwr[i] * str[1][i]) % P1;
    bcw[0][i] = (bcw[0][i - 1] + pwr[-i] * str[0][i]) % P1;
    bcw[1][i] = (bcw[1][i - 1] + pwr[-i] * str[1][i]) % P1;
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 4; j <= m; j += 2) {
      if (j > i * 2) break;
      long long h0 = ((fwd[0][i] - fwd[0][i - j / 2] + P1) * pwr[j - 1 - i] +
                      (bcw[1][i] - bcw[1][i - j / 2] + P1) * pwr[i]) %
                     P1;
      long long h1 = ((fwd[1][i] - fwd[1][i - j / 2] + P1) * pwr[j - 1 - i] +
                      (bcw[0][i] - bcw[0][i - j / 2] + P1) * pwr[i]) %
                     P1;
      if (h0 == pre_hash[j]) lft[1][i][j] = 1;
      if (h1 == pre_hash[j]) lft[0][i][j] = 1;
    }
  }
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 4; j <= m; j += 2) {
      if (j > (n - i + 1) * 2) break;
      long long h0 =
          ((fwd[0][i + j / 2 - 1] - fwd[0][i - 1] + P1) * pwr[-i] +
           (bcw[1][i + j / 2 - 1] - bcw[1][i - 1] + P1) * pwr[i + j - 1]) %
          P1;
      long long h1 =
          ((fwd[1][i + j / 2 - 1] - fwd[1][i - 1] + P1) * pwr[-i] +
           (bcw[0][i + j / 2 - 1] - bcw[0][i - 1] + P1) * pwr[i + j - 1]) %
          P1;
      if (h0 == suf_hash[j]) rgt[0][i][j] = 1;
      if (h1 == suf_hash[j]) rgt[1][i][j] = 1;
    }
  }
  memmove(tmp, lft, sizeof(tmp));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (str[0][i] == tar[j]) {
        if (j == 1) tmp[0][i][j] = 1;
        add(tmp[0][i][j], tmp[0][i - 1][j - 1]);
        if (j >= 2 && str[1][i] == tar[j - 1]) {
          if (j == 2) add(tmp[0][i][j], 1);
          add(tmp[0][i][j], tmp[1][i - 1][j - 2]);
        }
      }
      if (str[1][i] == tar[j]) {
        if (j == 1) tmp[1][i][j] = 1;
        add(tmp[1][i][j], tmp[1][i - 1][j - 1]);
        if (j >= 2 && str[0][i] == tar[j - 1]) {
          if (j == 2) add(tmp[1][i][j], 1);
          add(tmp[1][i][j], tmp[0][i - 1][j - 2]);
        }
      }
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      add(ans, tmp[0][i][j] * rgt[0][i + 1][m - j]);
      add(ans, tmp[1][i][j] * rgt[1][i + 1][m - j]);
    }
    add(ans, tmp[0][i][m]);
    add(ans, tmp[1][i][m]);
    add(ans, rgt[0][i][m]);
    add(ans, rgt[1][i][m]);
  }
}
bool pal() {
  for (int i = 1; i <= m; i++)
    if (tar[i] != tar[m - i + 1]) return false;
  return true;
}
int main() {
  init();
  input();
  work();
  if (m >= 2) {
    reverse(tar + 1, tar + m + 1);
    work();
    for (int i = 1; i <= n; i++)
      ans = (ans + MOD * 4 -
             (lft[0][i][m] + lft[1][i][m] + rgt[0][i][m] + rgt[1][i][m])) %
            MOD;
  }
  if (m == 2) {
    for (int i = 1; i <= n; i++) {
      if (str[0][i] == tar[1] && str[1][i] == tar[2])
        ans = (ans + MOD - 1) % MOD;
      if (str[1][i] == tar[1] && str[0][i] == tar[2])
        ans = (ans + MOD - 1) % MOD;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
