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 long long read() {
  long long x = 0;
  char ch = getchar();
  bool f = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return f ? -x : x;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  puts("");
}
const int N = 2005, mo = 1e9 + 7, base = 31;
const long long mod = 998244353;
int n, m, f[2][N][N];
long long bin[N];
char s[2][N], T[N];
struct info {
  long long sum[N];
  void init(int n, char *s, bool d) {
    if (!d) {
      sum[0] = 0;
      for (int i = 1; i <= n; i++)
        sum[i] = (sum[i - 1] * base + s[i] - 'a') % mod;
    } else {
      sum[n + 1] = 0;
      for (int i = n; i; i--) sum[i] = (sum[i + 1] * base + s[i] - 'a') % mod;
    }
  }
  long long find(int l, int r, bool d) {
    if (!d) return (sum[r] - sum[l - 1] * bin[r - l + 1] % mod + mod) % mod;
    return (sum[l] - sum[r + 1] * bin[r - l + 1] % mod + mod) % mod;
  }
} sump[2], sumf[2], t;
void add(int &x, int y) {
  x += y;
  if (x >= mo) x -= mo;
}
int dp(bool d) {
  int res = 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 <= min(m / 2, n - j + 1); k++) {
        if (t.find(m - 2 * k + 1, m - k, 0) == sump[i].find(j, j + k - 1, 0) &&
            t.find(m - k + 1, m, 0) == sumf[i ^ 1].find(j, j + k - 1, 1)) {
          if (2 * k != m || d) add(res, f[i][j][m - 2 * k]);
        }
      }
    }
    for (int i = 0; i < 2; i++) {
      for (int k = 2; k <= min(m / 2, j); k++) {
        if (t.find(1, k, 0) == sumf[i ^ 1].find(j - k + 1, j, 1) &&
            t.find(k + 1, 2 * k, 0) == sump[i].find(j - k + 1, j, 0)) {
          if (2 * k != m || d) add(f[i][j + 1][2 * k], 1);
        }
      }
    }
    for (int i = 0; i < 2; i++) {
      for (int k = 0; k <= m; k++) {
        if (s[i][j] == T[k + 1]) {
          add(f[i][j + 1][k + 1], f[i][j][k]);
          if (k + 2 <= m && s[i ^ 1][j] == T[k + 2])
            add(f[i ^ 1][j + 1][k + 2], f[i][j][k]);
        }
      }
    }
    for (int i = 0; i < 2; i++) add(res, f[i][j + 1][m]);
  }
  return res;
}
int main() {
  scanf("%s%s%s", s[0] + 1, s[1] + 1, T + 1);
  n = strlen(s[0] + 1);
  m = strlen(T + 1);
  t.init(m, T, 0);
  bin[0] = 1;
  for (int i = 1; i <= 2000; i++) bin[i] = bin[i - 1] * base % mod;
  for (int i = 0; i < 2; i++)
    sump[i].init(n, s[i], 0), sumf[i].init(n, s[i], 1);
  int ans = 0;
  add(ans, dp(1));
  if (m > 1) {
    reverse(T + 1, T + m + 1);
    t.init(m, T, 0);
    add(ans, dp(0));
    if (m == 2) {
      for (int j = 1; j <= n; j++) {
        for (int i = 0; i < 2; i++)
          if (s[i][j] == T[1] && s[i ^ 1][j] == T[2]) add(ans, mo - 1);
      }
    }
  }
  write(ans);
  return 0;
}