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 P = 1e9 + 7;
const int B = 131;
const int MAXN = 3e3 + 7;
int n, m;
char s[3][MAXN], t[MAXN];
long long pre[3][MAXN], suf[3][MAXN], pret[MAXN], bas[MAXN];
inline void init() {
  bas[0] = 1;
  for (int i = 1; i <= max(n, m); ++i) {
    bas[i] = 1ll * bas[i - 1] * B % P;
  }
  for (int i = 1; i <= n; ++i) {
    pre[1][i] = (pre[1][i - 1] * B + s[1][i] - 'a' + 1) % P;
    pre[2][i] = (pre[2][i - 1] * B + s[2][i] - 'a' + 1) % P;
  }
  for (int i = n; i >= 1; --i) {
    suf[1][i] = (suf[1][i + 1] * B + s[1][i] - 'a' + 1) % P;
    suf[2][i] = (suf[2][i + 1] * B + s[2][i] - 'a' + 1) % P;
  }
  return;
}
long long ans1, ans;
int f[3][MAXN][MAXN], g[3][MAXN][MAXN];
inline long long getpre(int x, int y, int id) {
  return (pre[id][y] - pre[id][x - 1] * bas[(y - x + 1)] % P + P) % P;
}
inline long long getsuf(int x, int y, int id) {
  return (suf[id][x] - suf[id][y + 1] * bas[(y - x + 1)] % P + P) % P;
}
inline long long merge(long long x, long long y, long long L) {
  return (y + 1ll * x * bas[L] % P) % P;
}
inline void solve() {
  memset(g, 0, sizeof(g));
  memset(f, 0, sizeof(f));
  pret[0] = 0;
  for (int i = 1; i <= m; ++i) {
    pret[i] = (pret[i - 1] * B % P + t[i] - 'a' + 1) % P;
  }
  for (int k = 1; k <= 2; ++k)
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= i; ++j) {
        int len = (i - j + 1) * 2;
        if (len > m) continue;
        long long S1 = getpre(j, i, k);
        long long S2 = getsuf(j, i, 3 - k);
        long long T1 = pret[len];
        if (merge(S2, S1, i - j + 1) == T1) {
          if (len == m) {
            ans1++;
          } else
            g[k][i][len] = 1;
        }
      }
    }
  for (int k = 1; k <= 2; ++k)
    for (int i = 1; i <= n; ++i) {
      if (t[1] == s[k][i]) g[k][i][1] = 1;
    }
  for (int j = 1; j < m; ++j) {
    for (int i = 1; i <= n; ++i) {
      for (int k = 1; k <= 2; ++k) {
        if (g[k][i][j]) {
          if (i < n && s[k][i + 1] == t[j + 1]) {
            f[k][i + 1][j + 1] = (1ll * f[k][i + 1][j + 1] + g[k][i][j]) % P;
          }
        }
        if (f[k][i][j]) {
          if (i < n && s[k][i + 1] == t[j + 1]) {
            f[k][i + 1][j + 1] = (1ll * f[k][i + 1][j + 1] + f[k][i][j]) % P;
          }
          if (s[3 - k][i] == t[j + 1]) {
            g[3 - k][i][j + 1] = (1ll * g[3 - k][i][j + 1] + f[k][i][j]) % P;
          }
        }
      }
    }
  }
  for (int i = m; i >= 1; --i) {
    pret[i] = (pret[i + 1] * B % P + t[i] - 'a' + 1) % P;
  }
  for (int k = 1; k <= 2; ++k) {
    for (int i = 1; i <= n; ++i) {
      if (s[k][i] == t[m]) {
        if (m == 1) ans++;
        ans = (ans + f[k][i - 1][m - 1]) % P;
        ans = (ans + g[k][i - 1][m - 1]) % P;
        ans %= P;
      }
      for (int j = i; j <= n; ++j) {
        int len = (j - i + 1) * 2;
        if (len > m) continue;
        long long S1 = getpre(i, j, 3 - k);
        long long S2 = getsuf(i, j, k);
        long long T2 = pret[m - len + 1];
        if (merge(S1, S2, j - i + 1) == T2) {
          if (len == m && m != 2)
            ans1++;
          else {
            ans = (ans + f[k][i - 1][m - len]) % P;
            ans = (ans + g[k][i - 1][m - len]) % P;
            ans %= P;
          }
        }
      }
    }
  }
  return;
}
int main() {
  cin >> (s[1] + 1);
  cin >> (s[2] + 1);
  cin >> (t + 1);
  n = strlen(s[1] + 1);
  m = strlen(t + 1);
  init();
  solve();
  reverse(t + 1, t + m + 1);
  solve();
  ans = (ans + ans1 / 2) % P;
  if (m == 1) ans /= 2;
  printf("%lld\n", ans);
  return 0;
}
