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 v = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    v = v * 10 + c - '0';
    c = getchar();
  }
  return v * f;
}
const int Maxn = 2005;
const long long mod1 = 998244353;
const long long mod2 = 1e9 + 9;
const int mod = 1e9 + 7;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
void add(int &x, int y) {
  x += y;
  if (x >= mod) {
    x -= mod;
  }
}
char c[2][Maxn];
long long Hc[2][Maxn][Maxn];
char w[Maxn];
long long H[Maxn][Maxn];
int dp[2][Maxn][Maxn];
int n, l;
int ans;
void _init_hash() {
  long long Ha1 = 0, Ha2 = 0;
  for (int i = 0; i < l; i++) {
    Ha1 = 0;
    Ha2 = 0;
    for (int j = i; j < l; j++) {
      Ha1 = (Ha1 * 11451419 + w[j]) % mod1;
      Ha2 = (Ha2 * 19198101 + w[j]) % mod2;
      H[i][j] = Ha1 * mod2 + Ha2;
    }
  }
  for (int _ = 0; _ < 2; _++) {
    for (int i = 0; i < n; i++) {
      Ha1 = 0;
      Ha2 = 0;
      for (int j = i; j < n; j++) {
        Ha1 = (Ha1 * 11451419 + c[_][j]) % mod1;
        Ha2 = (Ha2 * 19198101 + c[_][j]) % mod2;
        Hc[_][i][j] = Ha1 * mod2 + Ha2;
      }
    }
    for (int i = 0; i < n; i++) {
      Ha1 = 0;
      Ha2 = 0;
      for (int j = i; j >= 0; j--) {
        Ha1 = (Ha1 * 11451419 + c[_][j]) % mod1;
        Ha2 = (Ha2 * 19198101 + c[_][j]) % mod2;
        Hc[_][i][j] = Ha1 * mod2 + Ha2;
      }
    }
  }
}
void Calc(int T = 0) {
  memset(dp, 0, sizeof(dp));
  _init_hash();
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k <= j + 1; k++) {
        if (k == 1) continue;
        if (k * 2 > l) continue;
        bool flag = false;
        if (k == 0) {
          flag = true;
        }
        if (!flag) {
          flag = (Hc[i ^ 1][j][j - k + 1] == H[0][k - 1]);
          flag &= (Hc[i][j - k + 1][j] == H[k][2 * k - 1]);
        }
        if (T && k * 2 == l) {
          continue;
        }
        if (flag) {
          dp[i][j][k * 2] = 1;
        }
      }
    }
  }
  for (int i = -1; i < n - 1; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < l; k++) {
        if (i == -1) {
          if (k == 0) {
            int tmp = 1;
            if (k < l && w[k] == c[j][i + 1]) {
              add(dp[j][i + 1][k + 1], tmp);
            }
            if (k + 1 < l && w[k] == c[j][i + 1] &&
                w[k + 1] == c[j ^ 1][i + 1]) {
              add(dp[j ^ 1][i + 1][k + 2], tmp);
            }
          }
          continue;
        }
        if (dp[j][i][k]) {
          if (k < l && w[k] == c[j][i + 1]) {
            add(dp[j][i + 1][k + 1], dp[j][i][k]);
          }
          if (k + 1 < l && w[k] == c[j][i + 1] && w[k + 1] == c[j ^ 1][i + 1]) {
            add(dp[j ^ 1][i + 1][k + 2], dp[j][i][k]);
          }
        }
      }
    }
  }
  for (int i = 0; i < 2; i++) {
    for (int j = -1; j < n; j++) {
      for (int k = 0; k <= l; k++) {
        int WW;
        if (j == -1) {
          WW = (k == 0) ? 1 : 0;
        } else {
          WW = dp[i][j][k];
        }
        if (WW && (l - k) % 2 == 0) {
          int O = (l - k) >> 1;
          if (j + O >= n || O == 1) continue;
          bool flag = false;
          if (!O) flag = true;
          if (!flag) {
            flag = (Hc[i][j + 1][j + O] == H[l - O - O][l - O - 1]);
            flag &= (Hc[i ^ 1][j + O][j + 1] == H[l - O][l - 1]);
          }
          if (T && O == l / 2) {
            continue;
          }
          if (flag) add(ans, WW);
        }
      }
    }
  }
}
int main() {
  scanf("%s", c[0]);
  scanf("%s", c[1]);
  n = strlen(c[0]);
  scanf("%s", w);
  l = strlen(w);
  if (l == 1) {
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      cnt += (c[0][i] == w[0]);
      cnt += (c[1][i] == w[0]);
    }
    printf("%d\n", cnt);
    return 0;
  }
  if (l == 2) {
    int cnt = 0;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < 4; k++) {
          int ni = i + dx[k], nj = j + dy[k];
          if (ni >= 0 && ni < 2 && nj >= 0 && nj < n) {
            cnt += (c[i][j] == w[0] && c[ni][nj] == w[1]);
          }
        }
      }
    }
    printf("%d\n", cnt);
    return 0;
  }
  Calc();
  reverse(c[0], c[0] + n);
  reverse(c[1], c[1] + n);
  Calc(1);
  printf("%d\n", ans);
  return 0;
}