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>
const long long M = 1e9 + 7;
long long mi[2005];
struct hash {
  long long hash[2005];
  void make(int n, char *s) {
    hash[0] = 0;
    for (int i = 1; i <= n; i++) {
      hash[i] = (hash[i - 1] * 31 + s[i] - 'a') % M;
    }
  }
  long long cut(int l, int r) {
    return (hash[r] - hash[l - 1] * mi[r - l + 1] % M + M) % M;
  }
};
hash pre[2], suf[2], comp;
int n, m;
long long f[2][2005][2005];
long long ans;
char st[2005];
char S[2][2005];
long long solve(int flag) {
  long long ans = 0;
  memset(f, 0, sizeof(f));
  for (int j = 1; j <= n; j++) {
    f[0][j][0] = f[1][j][0] = 1;
    for (int i = 0; i < 2; i++) {
      for (int k = 2; k <= std::min(n - j + 1, m / 2); k++) {
        if (comp.cut(m - 2 * k + 1, m - k) == pre[i].cut(j, j + k - 1) &&
            comp.cut(m - k + 1, m) ==
                suf[i ^ 1].cut(n - (j + k - 1) + 1, n - j + 1)) {
          if (2 * k != m || flag) {
            ans = (ans + f[i][j][m - 2 * k]) % M;
          }
        }
      }
      for (int k = 2; k <= std::min(j, m / 2); k++) {
        if (comp.cut(k + 1, 2 * k) == pre[i].cut(j - k + 1, j) &&
            comp.cut(1, k) == suf[i ^ 1].cut(n - j + 1, n - (j - k + 1) + 1)) {
          if (2 * k != m || flag) {
            f[i][j + 1][2 * k] = (f[i][j + 1][2 * k] + 1) % M;
          }
        }
      }
    }
    for (int i = 0; i < 2; i++) {
      for (int k = 0; k < m; k++) {
        if (S[i][j] == st[k + 1]) {
          f[i][j + 1][k + 1] = (f[i][j + 1][k + 1] + f[i][j][k]) % M;
          if (k + 2 <= m && S[i ^ 1][j] == st[k + 2]) {
            f[i ^ 1][j + 1][k + 2] = (f[i ^ 1][j + 1][k + 2] + f[i][j][k]) % M;
          }
        }
      }
    }
    for (int i = 0; i < 2; i++) {
      ans = (ans + f[i][j + 1][m]);
    }
  }
  return ans;
}
int main() {
  scanf("%s%s%s", S[0] + 1, S[1] + 1, st + 1);
  n = strlen(S[0] + 1);
  m = strlen(st + 1);
  mi[0] = 1;
  for (int i = 1; i <= 2000; i++) {
    mi[i] = (mi[i - 1] * 31) % M;
  }
  for (int i = 0; i < 2; i++) {
    pre[i].make(n, S[i]);
    std::reverse(S[i] + 1, S[i] + n + 1);
    suf[i].make(n, S[i]);
    std::reverse(S[i] + 1, S[i] + n + 1);
  }
  comp.make(m, st);
  if (m == 1) {
    printf("%lld\n", solve(1) % M);
    return 0;
  }
  ans = 0;
  ans = (ans + solve(1)) % M;
  std::reverse(st + 1, st + m + 1);
  comp.make(m, st);
  ans = (ans + solve(0)) % M;
  if (m == 2) {
    for (int i = 1; i <= n; i++) {
      if (S[0][i] == st[1] && S[1][i] == st[2]) {
        ans = (ans - 1 + M) % M;
      }
      if (S[1][i] == st[1] && S[0][i] == st[2]) {
        ans = (ans - 1 + M) % M;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}