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 long long N = 3010, mo = 1e9 + 7, M = 23333333333333333, step = 31;
int f[N][N][2], n, m;
char s[2][N], t[N];
long long pw[N], ny[N];
long long mul(long long a, long long b, long long p = M) {
  long long c = (long double)a * b / p, z = a * b - c * p;
  if (z < 0) z += M;
  if (z > M) z -= M;
  return z;
}
long long power(long long a, long long b = M - 2) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = mul(ans, a);
    a = mul(a, a);
    b >>= 1;
  }
  return ans;
}
struct hash1 {
  long long a[N], b[N], n;
  void build(int _n, char *s) {
    n = _n;
    for (int i = 1; i <= n; i++)
      a[i] = (a[i - 1] + (s[i] - 'a' + 1) * pw[i]) % M,
      b[i] = (b[i - 1] * step + (s[i] - 'a' + 1)) % M;
  }
  long long query(int l, int r) {
    return mul((a[r] - a[l - 1] + M) % M, ny[l]);
  }
  long long iquery(int l, int r) {
    return (b[r] - mul(b[l - 1], pw[r - l + 1]) + M) % M;
  }
} h[2], g;
void prep() {
  pw[0] = ny[0] = 1;
  ny[1] = power(step);
  for (int i = 1; i <= n || i <= m; i++)
    ny[i] = mul(ny[i - 1], ny[1]), pw[i] = pw[i - 1] * step % M;
}
void move(int &a, int b) { a = (a + b) % mo; }
int ans;
void dp() {
  h[0].build(n, s[0]);
  h[1].build(n, s[1]);
  g.build(m, t);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i && j + j <= m; j++) {
      if (h[1].iquery(i - j + 1, i) == g.query(1, j) &&
          h[0].query(i - j + 1, i) == g.query(j + 1, 2 * j))
        move(f[i][2 * j][0], 1);
      if (h[0].iquery(i - j + 1, i) == g.query(1, j) &&
          h[1].query(i - j + 1, i) == g.query(j + 1, 2 * j))
        move(f[i][2 * j][1], 1);
    }
    if (s[0][i] == t[1]) move(f[i][1][0], 1);
    if (s[1][i] == t[1]) move(f[i][1][1], 1);
    for (int j = 1; j <= m; j++) {
      if (s[0][i + 1] == t[j + 1]) {
        move(f[i + 1][j + 1][0], f[i][j][0]);
        if (s[1][i + 1] == t[j + 2]) move(f[i + 1][j + 2][1], f[i][j][0]);
      }
      if (s[1][i + 1] == t[j + 1]) {
        move(f[i + 1][j + 1][1], f[i][j][1]);
        if (s[0][i + 1] == t[j + 2]) move(f[i + 1][j + 2][0], f[i][j][1]);
      }
    }
    for (int j = 2; j < m && i + j <= n; j++) {
      if (h[1].iquery(i + 1, i + j) == g.query(m - j + 1, m) &&
          h[0].query(i + 1, i + j) == g.query(m - 2 * j + 1, m - j))
        move(ans, f[i][m - 2 * j][0]);
      if (h[0].iquery(i + 1, i + j) == g.query(m - j + 1, m) &&
          h[1].query(i + 1, i + j) == g.query(m - 2 * j + 1, m - j))
        move(ans, f[i][m - 2 * j][1]);
    }
    move(ans, f[i][m][0]);
    move(ans, f[i][m][1]);
  }
}
int main() {
  scanf("%s", s[0] + 1);
  scanf("%s", s[1] + 1);
  n = strlen(s[0] + 1);
  scanf("%s", t + 1);
  scanf("%s", t + 1);
  m = strlen(t + 1);
  if (m == 1) {
    for (int i = 1; i <= n; i++) ans += (t[1] == s[0][i]) + (t[1] == s[1][i]);
    cout << ans << endl;
    return 0;
  }
  if (m == 2) {
    for (int i = 1; i <= n; i++)
      ans += (t[1] == s[0][i] && t[2] == s[1][i]) +
             (t[1] == s[1][i] && t[2] == s[0][i]);
    for (int i = 1; i < n; i++)
      for (int j = 0; j <= 1; j++)
        ans += (t[1] == s[j][i] && t[2] == s[j][i + 1]) +
               (t[1] == s[j][i + 1] && t[2] == s[j][i]);
    cout << ans << endl;
    return 0;
  }
  prep();
  dp();
  reverse(s[0] + 1, s[0] + n + 1);
  reverse(s[1] + 1, s[1] + n + 1);
  memset(f, 0, sizeof f);
  dp();
  cout << ans << endl;
}