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;
int a14;
inline int rd(int l, int r) { return rand() % (r - l + 1) + l; }
const int mxn = 2003, mod = 1e9 + 7, B = 137, MO = 1e9 + 9;
int n, m, sn;
char s[2][mxn], ss[mxn], as[mxn * 3];
long long ha[mxn * 3], ah[mxn * 3], bin[mxn * 3];
inline long long HA(int l, int r) {
  assert(r >= l);
  return (ha[r] - ha[l - 1] * bin[r - l + 1] % MO + MO) % MO;
}
inline long long AH(int r, int l) {
  assert(r >= l);
  return (ah[l] - ah[r + 1] * bin[r - l + 1] % MO + MO) % MO;
}
inline long long H3(int l, int r) { return HA(2 * n + l, 2 * n + r); }
long long ans, dp[2][mxn][mxn];
inline void W() {
  sn = 0;
  for (int i = 1; i <= n; ++i) as[++sn] = s[0][i];
  for (int i = 1; i <= n; ++i) as[++sn] = s[1][i];
  for (int i = 1; i <= m; ++i) as[++sn] = ss[i];
  for (int i = 1; i <= sn; ++i) ha[i] = (ha[i - 1] * B + as[i]) % MO;
  for (int i = sn; i; --i) ah[i] = (ah[i + 1] * B + as[i]) % MO;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m && j <= 2 * i; ++j) {
      dp[0][i][j] = dp[1][i][j] = 0;
      if (j == 1)
        dp[0][i][j] = s[0][i] == ss[1], dp[1][i][j] = s[1][i] == ss[1];
      else {
        if (j % 2 == 0)
          dp[0][i][j] = AH(n + i, n + i - j / 2 + 1) == H3(1, j / 2) &&
                        H3(j / 2 + 1, j) == HA(i - j / 2 + 1, i),
          dp[1][i][j] = AH(i, i - j / 2 + 1) == H3(1, j / 2) &&
                        H3(j / 2 + 1, j) == HA(n + i - j / 2 + 1, n + i);
        if (j == m) ans += dp[0][i][j] + dp[1][i][j];
        if (s[0][i] == ss[j]) {
          (dp[0][i][j] += dp[0][i - 1][j - 1]) %= mod;
          if (s[1][i] == ss[j - 1]) (dp[0][i][j] += dp[1][i - 1][j - 2]) %= mod;
        }
        if (s[1][i] == ss[j]) {
          (dp[1][i][j] += dp[1][i - 1][j - 1]) %= mod;
          if (s[0][i] == ss[j - 1]) (dp[1][i][j] += dp[0][i - 1][j - 2]) %= mod;
        }
      }
      if (j == m - 1) {
        if (ss[m] == s[0][i + 1]) ans += dp[0][i][j];
        if (ss[m] == s[1][i + 1]) ans += dp[1][i][j];
      } else if ((m - j) % 2 == 0 && j != m && (n - i) * 2 + j >= m) {
        int k = (m - j) / 2;
        if (HA(i + 1, i + k) == H3(j + 1, j + k) &&
            AH(n + i + k, n + i + 1) == H3(j + k + 1, m))
          ans += dp[0][i][j];
        if (HA(n + i + 1, n + i + k) == H3(j + 1, j + k) &&
            AH(i + k, i + 1) == H3(j + k + 1, m))
          ans += dp[1][i][j];
      }
    }
}
int main() {
  a14 = scanf("%s%s%s", s[0] + 1, s[1] + 1, ss + 1);
  n = strlen(s[0] + 1), m = strlen(ss + 1);
  if (m == 1) {
    for (int i = 1; i <= n; ++i)
      ans += ss[1] == s[0][i], ans += ss[1] == s[1][i];
    printf("%lld\n", ans);
    return 0;
  }
  if (m == 2) {
    for (int i = 1; i <= n; ++i)
      ans += s[0][i] == ss[1] && s[1][i] == ss[2],
          ans += s[0][i] == ss[2] && s[1][i] == ss[1];
    for (int i = 1; i < n; ++i)
      ans += s[0][i] == ss[1] && s[0][i + 1] == ss[2],
          ans += s[0][i] == ss[2] && s[0][i + 1] == ss[1],
          ans += s[1][i] == ss[1] && s[1][i + 1] == ss[2],
          ans += s[1][i] == ss[2] && s[1][i + 1] == ss[1];
    printf("%lld\n", ans);
    return 0;
  }
  bin[0] = 1;
  for (int i = 1; i < mxn * 3; ++i) bin[i] = bin[i - 1] * B % MO;
  W();
  reverse(s[0] + 1, s[0] + n + 1), reverse(s[1] + 1, s[1] + n + 1);
  W();
  ans %= mod;
  printf("%lld\n", ans);
  return 0;
}
