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 mod = 1e9 + 7;
char T[2][2005], S[2005];
int f[2][2005][2005];
inline void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int lhT[2][2005], rhT[2][2005], hS[2005], p[2005];
int lhsh(int t, int l, int r) {
  return (lhT[t][r] - 1ll * lhT[t][l - 1] * p[r - l + 1] % mod + mod) % mod;
}
int rhsh(int t, int l, int r) {
  return (rhT[t][l] - 1ll * rhT[t][r + 1] * p[r - l + 1] % mod + mod) % mod;
}
int Hsh(int l, int r) {
  return (hS[r] - 1ll * hS[l - 1] * p[r - l + 1] % mod + mod) % mod;
}
int main() {
  scanf("%s", T[0] + 1);
  scanf("%s", T[1] + 1);
  scanf("%s", S + 1);
  int n = strlen(T[0] + 1), l = strlen(S + 1);
  if (l == 1) {
    int ans = 0;
    for (int t = 0; t < 2; t++)
      for (int i = 1; i <= n; i++)
        if (T[t][i] == S[1]) ans++;
    printf("%d\n", ans);
    return 0;
  }
  if (l == 2) {
    int ans = 0;
    for (int t = 0; t < 2; t++)
      for (int i = 1; i < n; i++)
        if (T[t][i] == S[1] && T[t][i + 1] == S[2]) ans++;
    for (int t = 0; t < 2; t++)
      for (int i = 2; i <= n; i++)
        if (T[t][i] == S[1] && T[t][i - 1] == S[2]) ans++;
    for (int t = 0; t < 2; t++)
      for (int i = 1; i <= n; i++)
        if (T[t][i] == S[1] && T[t ^ 1][i] == S[2]) ans++;
    printf("%d\n", ans);
    return 0;
  }
  p[0] = 1;
  for (int i = 1; i <= 2000; i++) p[i] = p[i - 1] * 31ll % mod;
  for (int t = 0; t < 2; t++) {
    for (int i = 1; i <= n; i++)
      lhT[t][i] = (lhT[t][i - 1] * 31ll + T[t][i] - 'a' + 1) % mod;
    for (int i = n; i >= 1; i--)
      rhT[t][i] = (rhT[t][i + 1] * 31ll + T[t][i] - 'a' + 1) % mod;
  }
  for (int i = 1; i <= l; i++)
    hS[i] = (hS[i - 1] * 31ll + S[i] - 'a' + 1) % mod;
  f[0][0][0] = f[1][0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int t = 0; t < 2; t++) {
      f[t][i][0] = 1;
      for (int j = 0; j <= l; j++) {
        if (S[j + 1] == T[t][i]) add(f[t][i][j + 1], f[t][i - 1][j]);
        if (S[j + 1] == T[t ^ 1][i] && S[j + 2] == T[t][i])
          add(f[t][i][j + 2], f[t ^ 1][i - 1][j]);
      }
      for (int j = 1; j < i; j++) {
        int x = i - j + 1;
        if (x * 2 > l) continue;
        if (rhsh(t ^ 1, j, i) == Hsh(1, x) &&
            lhsh(t, j, i) == Hsh(x + 1, 2 * x))
          add(f[t][i][2 * x], 1);
      }
    }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int t = 0; t < 2; t++) {
      add(ans, f[t][i][l]);
      for (int j = i + 1; j <= n; j++) {
        int x = j - i + 1;
        if (2 * x >= l) break;
        if (rhsh(t ^ 1, i, j) == Hsh(l - x + 1, l) &&
            lhsh(t, i, j) == Hsh(l - 2 * x + 1, l - x)) {
          add(ans, f[t][i - 1][l - 2 * x]);
        }
      }
    }
  for (int i = 1; i <= l; i++)
    if (i < l - i + 1) swap(S[i], S[l - i + 1]);
  for (int i = 1; i <= l; i++)
    hS[i] = (hS[i - 1] * 31ll + S[i] - 'a' + 1) % mod;
  memset(f, 0, sizeof(f));
  f[0][0][0] = f[1][0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int t = 0; t < 2; t++) {
      f[t][i][0] = 1;
      for (int j = 0; j <= l; j++) {
        if (S[j + 1] == T[t][i]) add(f[t][i][j + 1], f[t][i - 1][j]);
        if (S[j + 1] == T[t ^ 1][i] && S[j + 2] == T[t][i])
          add(f[t][i][j + 2], f[t ^ 1][i - 1][j]);
      }
      for (int j = 1; j < i; j++) {
        int x = i - j + 1;
        if (2 * x >= l) continue;
        if (rhsh(t ^ 1, j, i) == Hsh(1, x) &&
            lhsh(t, j, i) == Hsh(x + 1, 2 * x))
          add(f[t][i][2 * x], 1);
      }
    }
  for (int i = 1; i <= n; i++)
    for (int t = 0; t < 2; t++) {
      add(ans, f[t][i][l]);
      for (int j = i + 1; j <= n; j++) {
        int x = j - i + 1;
        if (2 * x > l) break;
        if (rhsh(t ^ 1, i, j) == Hsh(l - x + 1, l) &&
            lhsh(t, i, j) == Hsh(l - 2 * x + 1, l - x)) {
          add(ans, f[t][i - 1][l - 2 * x]);
        }
      }
    }
  printf("%d\n", ans);
  return 0;
}
