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;
inline int read() {
  int x = 0, y = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') y = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * y;
}
void put(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) put(x / 10);
  putchar((x % 10) + 48);
}
inline void Add(int &x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
}
const int P = 37;
long long hsh[4][2010], pw[2010];
void calhsh(char *s, int p, int n) {
  for (int i = 1; i <= n; ++i)
    hsh[p][i] = (hsh[p][i - 1] * P + s[i] - 'a') % 1000000007;
}
long long get(int p, int l, int r) {
  if (p == 3)
    return ((hsh[p][l] - hsh[p][r + 1] * pw[r - l + 1]) % 1000000007 +
            1000000007) %
           1000000007;
  return ((hsh[p][r] - hsh[p][l - 1] * pw[r - l + 1]) % 1000000007 +
          1000000007) %
         1000000007;
}
inline bool cmp(int p1, int l1, int r1, int p2, int l2, int r2) {
  return get(p1, l1, r1) == get(p2, l2, r2);
}
int f[2010][2][2010], ans;
int n, m;
char S[2][2010], T[2010];
void sol() {
  memset(f, 0, sizeof(f));
  for (int i = 2; i <= n; ++i) {
    for (int d = 0; d < 2; ++d) {
      for (int j = 2; j <= i && j * 2 <= m; ++j)
        if (cmp(d ^ 1, i - j + 1, i, 3, 1, j) &&
            cmp(d, i - j + 1, i, 2, j + 1, j * 2))
          f[i][d][j * 2]++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int d = 0; d < 2; ++d) {
      if (T[1] == S[d][i]) f[i][d][1]++;
      if (T[2] == S[d][i] && T[1] == S[d ^ 1][i]) f[i][d][2]++;
    }
  }
  for (int i = 1; i < n; ++i)
    for (int d = 0; d < 2; ++d)
      for (int j = 1; j < m; ++j)
        if (f[i][d][j]) {
          if (S[d][i + 1] == T[j + 1]) {
            Add(f[i + 1][d][j + 1], f[i][d][j]);
            if (j + 2 <= m && S[d ^ 1][i + 1] == T[j + 2])
              Add(f[i + 1][d ^ 1][j + 2], f[i][d][j]);
          }
        }
  for (int i = 0; i <= n; ++i) f[i][0][0] = f[i][1][0] = 1;
  for (int i = 0; i <= n; ++i) {
    for (int d = 0; d < 2; ++d) {
      for (int j = 0; j <= m; ++j) {
        if (f[i][d][j] && !((m - j) & 1)) {
          int l = (m - j) >> 1;
          if (l > n - i || l == 1) continue;
          if (cmp(d, i + 1, i + l, 2, j + 1, j + l) &&
              cmp(d ^ 1, i + 1, i + l, 3, j + l + 1, m))
            Add(ans, f[i][d][j]);
        }
      }
    }
  }
}
signed main() {
  scanf("%s%s%s", S[0] + 1, S[1] + 1, T + 1);
  n = strlen(S[0] + 1), m = strlen(T + 1);
  if (m == 1) {
    int ans = 0;
    for (int i = 0; i < 2; ++i)
      for (int j = 1; j <= n; ++j) ans += S[i][j] == T[1];
    cout << ans << "\n";
    return 0;
  }
  if (m == 2) {
    int ans = 0;
    for (int x = 0; x < 2; ++x)
      for (int y = 1; y <= n; ++y)
        if (S[x][y] == T[1]) {
          if (S[x ^ 1][y] == T[2]) ans++;
          if (y > 1 && S[x][y - 1] == T[2]) ans++;
          if (y < n && S[x][y + 1] == T[2]) ans++;
        }
    cout << ans << "\n";
    return 0;
  }
  pw[0] = 1;
  for (int i = 1; i <= max(n, m); ++i) pw[i] = pw[i - 1] * P % 1000000007;
  calhsh(S[0], 0, n);
  calhsh(S[1], 1, n);
  calhsh(T, 2, m);
  reverse(T + 1, T + m + 1);
  calhsh(T, 3, m);
  reverse(T + 1, T + m + 1);
  reverse(hsh[3] + 1, hsh[3] + m + 1);
  sol();
  swap(hsh[3], hsh[2]);
  reverse(T + 1, T + m + 1);
  reverse(hsh[3] + 1, hsh[3] + m + 1);
  reverse(hsh[2] + 1, hsh[2] + m + 1);
  sol();
  if (m % 2 == 0) {
    int p = m / 2;
    for (int i = p; i <= n; ++i)
      for (int d = 0; d < 2; ++d) {
        if (cmp(d, i - p + 1, i, 2, 1, p) &&
            cmp(d ^ 1, i - p + 1, i, 3, p + 1, m))
          ans--;
        if (cmp(d, i - p + 1, i, 3, 1, p) &&
            cmp(d ^ 1, i - p + 1, i, 2, p + 1, m))
          ans--;
      }
    ans = (ans % 1000000007 + 1000000007) % 1000000007;
  }
  cout << ans << "\n";
  return 0;
}