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 N = 2e3 + 10;
namespace HASH {
int MOD1 = 1004535809, MOD2 = 167772161;
int h_s1[N << 1], h_s2[N << 1], h_v1[N << 1], h_v2[N << 1];
int h_add(int x, int y, int MOD) { return x + y >= MOD ? x + y - MOD : x + y; }
int h_sub(int x, int y, int MOD) { return x < y ? x + MOD - y : x - y; }
int h_mul(int x, int y, int MOD) { return 1ll * x * y % MOD; }
int h_Pow(int x, int y, int MOD) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = h_mul(ret, x, MOD);
    x = h_mul(x, x, MOD), y >>= 1;
  }
  return ret;
}
class Hash {
 public:
  int f, s;
  Hash(int f = 0, int s = 0) : f(f), s(s) {}
  inline friend Hash operator+(Hash H1, Hash H2) {
    return (Hash){h_add(H1.f, H2.f, MOD1), h_add(H1.s, H2.s, MOD2)};
  }
  inline friend Hash operator-(Hash H1, Hash H2) {
    return (Hash){h_sub(H1.f, H2.f, MOD1), h_sub(H1.s, H2.s, MOD2)};
  }
  inline friend Hash operator*(Hash H1, Hash H2) {
    return (Hash){h_mul(H1.f, H2.f, MOD1), h_mul(H1.s, H2.s, MOD2)};
  }
  inline friend int operator==(Hash H1, Hash H2) {
    return (H1.f == H2.f) && (H1.s == H2.s);
  }
  inline friend int operator!=(Hash H1, Hash H2) {
    return (H1.f != H2.f) || (H1.s != H2.s);
  }
  inline friend Hash operator<<(Hash H1, int t) {
    return (Hash){h_mul(H1.f, h_s1[t], MOD1), h_mul(H1.s, h_s2[t], MOD2)};
  }
  inline friend Hash operator>>(Hash H1, int t) {
    return (Hash){h_mul(H1.f, h_v1[t], MOD1), h_mul(H1.s, h_v2[t], MOD2)};
  }
};
void init(int n) {
  h_s1[0] = h_s2[0] = 1;
  h_s1[1] = 233, h_s2[1] = 239;
  for (int i = 2; i <= n; i++) h_s1[i] = h_mul(h_s1[i - 1], h_s1[1], MOD1);
  for (int i = 2; i <= n; i++) h_s2[i] = h_mul(h_s2[i - 1], h_s2[1], MOD2);
  for (int i = 0; i <= n; i++) h_v1[i] = h_Pow(h_s1[i], MOD1 - 2, MOD1);
  for (int i = 0; i <= n; i++) h_v2[i] = h_Pow(h_s2[i], MOD2 - 2, MOD2);
}
Hash mk_c(char c) { return Hash(c - 'a', c - 'a'); }
Hash mk_s(char *s) {
  int len = strlen(s);
  Hash ret(0, 0);
  for (int i = 0; i < len; i++) ret = (ret << 1) + mk_c(s[i]);
  return ret;
}
Hash mk_s(string s) {
  Hash ret(0, 0);
  for (int i = 0; i < s.size(); i++) ret = (ret << 1) + mk_c(s[i]);
  return ret;
}
};  // namespace HASH
using namespace HASH;
const int P = 1000000007;
inline int add(int x, int y) { return x + y >= P ? x + y - P : x + y; }
inline int sub(int x, int y) { return x < y ? x - y + P : x - y; }
inline int mul(int x, int y) { return 1ll * x * y % P; }
inline int upd(int &x, int y) { x = add(x, y); }
char s[3][N];
Hash h[2][3][N];
int n, m, f[2][N][N], g[2][N][N], a[2][N][N], b[2][N][N], ans, same;
Hash H(int o, int i, int l, int r) {
  if (o == 0) return h[o][i][r] - (h[o][i][l - 1] << (r - l + 1));
  if (o == 1) return h[o][i][l] - (h[o][i][r + 1] << (r - l + 1));
}
int check(int o, int i, int j, int k) {
  if (!o) {
    if (j < k) return 0;
    if (H(1, i ^ 1, j - k + 1, j) != H(0, 2, 1, k)) return 0;
    if (H(0, i, j - k + 1, j) != H(0, 2, k + 1, k << 1)) return 0;
    return 1;
  }
  if (j + k - 1 > n) return 0;
  if (H(0, i, j, j + k - 1) != H(0, 2, m - 2 * k + 1, m - k)) return 0;
  if (H(1, i ^ 1, j, j + k - 1) != H(0, 2, m - k + 1, m)) return 0;
  return 1;
}
void solve() {
  for (int i = 1; i <= m; i++)
    h[0][2][i] = (h[0][2][i - 1] << 1) + mk_c(s[2][i]);
  for (int i = 0; i <= 1; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= m; k++) {
        f[i][j][k] = g[i][j][k] = 0;
        if (k == 1) {
          g[i][j][k] = a[i][j][k] = s[i][j] == s[2][1];
          b[i][j][k] = s[i][j] == s[2][m];
        } else if (k % 2 == 0) {
          g[i][j][k] = a[i][j][k] = check(0, i, j, k / 2);
          b[i][j][k] = check(1, i, j, k / 2);
        }
        if (k == m) {
          same += a[i][j][k];
          if (m > 2) same += b[i][j][k];
        }
      }
  for (int j = 1; j <= n; j++)
    for (int k = 1; k < m; k++) {
      for (int i = 0; i <= 1; i++)
        if (s[i][j] == s[2][k])
          upd(f[i][j][k], add(f[i][j - 1][k - 1], g[i][j - 1][k - 1]));
      for (int i = 0; i <= 1; i++)
        if (s[i][j] == s[2][k]) upd(g[i][j][k], f[i ^ 1][j][k - 1]);
      for (int i = 0; i <= 1; i++)
        if (b[i][j + 1][m - k]) upd(ans, add(f[i][j][k], g[i][j][k]));
    }
}
int main() {
  scanf("%s%s%s", s[0] + 1, s[1] + 1, s[2] + 1);
  n = strlen(s[0] + 1), m = strlen(s[2] + 1), init(n << 1);
  for (int i = 0; i <= 1; i++) {
    for (int j = 1; j <= n; j++)
      h[0][i][j] = (h[0][i][j - 1] << 1) + mk_c(s[i][j]);
    for (int j = n; j >= 1; j--)
      h[1][i][j] = (h[1][i][j + 1] << 1) + mk_c(s[i][j]);
  }
  solve(), reverse(s[2] + 1, s[2] + m + 1);
  solve(), printf("%d\n", add(ans, same / 2));
  return 0;
}
