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;
const int MAXN = 2e3 + 5;
const int INF = 1 << 30;
const int mod = 1e9 + 7;
int lowbit(int x) { return x & (-x); }
int fast_power(int a, int b) {
  int x;
  for (x = 1; b; b >>= 1) {
    if (b & 1) x = 1ll * x * a % mod;
    a = 1ll * a * a % mod;
  }
  return x % mod;
}
int n, m, ans;
int nxt_l[MAXN][MAXN][2], nxt_r[MAXN][MAXN][2];
int pre_l[MAXN][MAXN][2], pre_r[MAXN][MAXN][2];
int Ul[MAXN][MAXN][2], Ur[MAXN][MAXN][2];
int f[MAXN][MAXN][2], g[MAXN][MAXN][2];
char st[2][MAXN], str[MAXN];
void work() {
  memset(f, 0, sizeof(f));
  memset(g, 0, sizeof(g));
  for (int i = 0; i <= 1; i++) {
    for (int k = m; k >= 1; k--) {
      for (int j = n; j >= 1; j--) {
        if (st[i][j] == str[k])
          nxt_r[j][k][i] = nxt_r[j + 1][k + 1][i] + 1;
        else
          nxt_r[j][k][i] = 0;
      }
      for (int j = 1; j <= n; j++) {
        if (st[i][j] == str[k])
          nxt_l[j][k][i] = nxt_l[j - 1][k + 1][i] + 1;
        else
          nxt_l[j][k][i] = 0;
      }
    }
    for (int k = 1; k <= m; k++) {
      for (int j = n; j >= 1; j--) {
        if (st[i][j] == str[k])
          pre_r[j][k][i] = pre_r[j + 1][k - 1][i] + 1;
        else
          pre_r[j][k][i] = 0;
      }
      for (int j = 1; j <= n; j++) {
        if (st[i][j] == str[k])
          pre_l[j][k][i] = pre_l[j - 1][k - 1][i] + 1;
        else
          pre_l[j][k][i] = 0;
      }
    }
  }
  for (int j = 0; j <= 1; j++) {
    for (int i = 1; i <= n; i++) {
      for (int k = 2; k <= min(n - i + 1, m / 2); k++) {
        Ur[i][k][j] = pre_r[i][m][!j] >= k && pre_l[i + k - 1][m - k][j] >= k;
      }
      for (int k = 2; k <= min(i, m / 2); k++) {
        Ul[i][k][j] = nxt_l[i][1][!j] >= k && nxt_r[i - k + 1][k + 1][j] >= k;
      }
    }
  }
  if (!(m & 1)) {
    for (int i = 1; i <= n; i++) {
      ans = (ans + Ur[i][m / 2][1]) % mod;
      ans = (ans + Ul[i][m / 2][1]) % mod;
      for (int j = 0; j <= 1; j++) {
        for (int k = 2; k <= m / 2 - 2; k++) {
          if (Ul[i][k][j] && Ur[i + 1][m / 2 - k][j]) ans = (ans + 1) % mod;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 1; j++) {
      if (st[j][i] == str[1]) f[i][1][j] = (f[i][1][j] + 1) % mod;
      for (int k = 2; k <= m / 2; k++) {
        if (Ul[i - 1][k][j] && st[j][i] == str[k + k + 1])
          f[i][k + k + 1][j] = (f[i][k + k + 1][j] + 1) % mod;
      }
      for (int k = 1; k <= m; k++) {
        if (st[j][i] == str[k + 1]) {
          f[i][k + 1][j] = (f[i][k + 1][j] + f[i - 1][k][j]) % mod;
          f[i][k + 1][j] = (f[i][k + 1][j] + g[i - 1][k][j]) % mod;
        }
      }
      for (int k = 1; k <= m; k++) {
        if (st[!j][i] == str[k + 1]) {
          g[i][k + 1][!j] = (g[i][k + 1][!j] + f[i][k][j]) % mod;
        }
      }
    }
    for (int j = 0; j <= 1; j++) {
      ans = (ans + f[i][m][j]) % mod;
      ans = (ans + g[i][m][j]) % mod;
      for (int k = 2; k <= m / 2; k++) {
        if (Ur[i + 1][k][j]) {
          ans = (ans + f[i][m - 2 * k][j]) % mod;
          ans = (ans + g[i][m - 2 * k][j]) % mod;
        }
      }
    }
  }
}
int main() {
  scanf("%s", st[0] + 1);
  scanf("%s", st[1] + 1);
  scanf("%s", str + 1);
  n = strlen(st[0] + 1), m = strlen(str + 1);
  if (m == 1) {
    int ans = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j <= 1; j++)
        if (st[j][i] == str[1]) ans++;
    printf("%d\n", ans);
    return 0;
  }
  if (m == 2) {
    int ans = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j <= 1; j++) {
        if (st[j][i] == str[1]) {
          if (st[!j][i] == str[2]) ans++;
          if (st[j][i - 1] == str[2]) ans++;
          if (st[j][i + 1] == str[2]) ans++;
        }
      }
    printf("%d\n", ans);
    return 0;
  }
  work();
  reverse(str + 1, str + m + 1);
  work();
  printf("%d\n", ans);
  return 0;
}