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;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return ~f ? s : -s;
}
const int maxn = 2e3 + 20;
const int mod = 1e9 + 7;
inline void pls(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int n, m;
char str[3][maxn];
char T[maxn];
int d[4][2] = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
inline void init() {
  for (int i = (1), _end_ = (2); i <= _end_; i++) scanf("%s", str[i] + 1);
  n = strlen(str[1] + 1);
  scanf("%s", T + 1);
  m = strlen(T + 1);
  if (m == 1) {
    int ans = 0;
    for (int i = (1), _end_ = (2); i <= _end_; i++)
      for (int j = (1), _end_ = (n); j <= _end_; j++)
        if (str[i][j] == T[1]) ans++;
    printf("%d\n", ans);
    exit(0);
  } else if (m == 2) {
    int ans = 0;
    for (int x = (1), _end_ = (2); x <= _end_; x++)
      for (int y = (1), _end_ = (n); y <= _end_; y++)
        if (str[x][y] == T[1]) {
          int xx, yy;
          for (int l = (0), _end_ = (3); l <= _end_; l++) {
            xx = x + d[l][0];
            yy = y + d[l][1];
            if (str[xx][yy] == T[2]) ans++;
          }
        }
    printf("%d\n", ans);
    exit(0);
  }
}
int f[3][maxn][maxn];
int L[3][maxn][maxn], R[3][maxn][maxn];
int ans;
inline void doing(int op) {
  memset(f, 0, sizeof(f));
  memset(L, 0, sizeof(L));
  memset(R, 0, sizeof(R));
  for (int i = (1), _end_ = (2); i <= _end_; i++) {
    for (int j = (1), _end_ = (n); j <= _end_; j++)
      for (int k = (1), _end_ = (m); k <= _end_; k++)
        if (str[i][j] == T[k])
          L[i][j][k] = L[i][j - 1][k - 1] + 1;
        else
          L[i][j][k] = 0;
    for (int j = (n), _end_ = (1); j >= _end_; j--)
      for (int k = (m), _end_ = (1); k >= _end_; k--)
        if (str[i][j] == T[k])
          R[i][j][k] = R[i][j + 1][k - 1] + 1;
        else
          R[i][j][k] = 0;
  }
  for (int j = (1), _end_ = (n); j <= _end_; j++) {
    for (int i = (1), _end_ = (2); i <= _end_; i++) {
      if (str[i][j] == T[1]) pls(f[i][j][1], 1);
      for (int k = (1), _end_ = (min(j, m >> 1)); k <= _end_; k++)
        if (R[i][j - k + 1][k] >= k && L[3 - i][j][k << 1] >= k)
          pls(f[3 - i][j][k << 1], 1);
    }
    for (int i = (1), _end_ = (2); i <= _end_; i++) {
      pls(ans, f[i][j][m]);
      for (int k = (2), _end_ = (min(n - j, m >> 1)); k <= _end_; k++)
        if (R[3 - i][j + 1][m] >= k && L[i][j + k][m - k] >= k)
          pls(ans, f[i][j][m - (k << 1)]);
    }
    for (int i = (1), _end_ = (2); i <= _end_; i++)
      for (int k = (1), _end_ = (m); k <= _end_; k++)
        if (f[i][j][k]) {
          if (str[i][j + 1] == T[k + 1]) {
            pls(f[i][j + 1][k + 1], f[i][j][k]);
            if (str[3 - i][j + 1] == T[k + 2])
              pls(f[3 - i][j + 1][k + 2], f[i][j][k]);
          }
        }
  }
}
int main() {
  init();
  doing(1);
  for (int i = (1), _end_ = (2); i <= _end_; i++)
    reverse(str[i] + 1, str[i] + n + 1);
  doing(2);
  printf("%d\n", ans);
  return 0;
}