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 maxn = 2E3 + 5;
int n, m;
char a[2][maxn], b[maxn * 2];
long long int ans;
long long int f[2][2][maxn][maxn];
long long int H1[maxn * 2], H2[maxn * 2];
struct Hash {
  long long int h1, h2;
  Hash(long long int a = 0, long long int b = 0, int c = 0) : h1(a), h2(b) {}
  Hash operator+(const char& x) {
    return Hash((h1 * 13131 + x) % 998244353, (h2 * 233 + x) % 1000000007);
  }
  Hash operator+(const Hash& x) {
    return Hash((h1 + x.h1) % 998244353, (h2 + x.h2) % 1000000007);
  }
  Hash operator*(const long long int& x) {
    return Hash(h1 * H1[x] % 998244353, h2 * H2[x] % 1000000007);
  }
  bool operator==(const Hash& A) { return h1 == A.h1 && h2 == A.h2; }
} H[2][maxn][maxn], strL[maxn], strR[maxn];
inline void init() {
  memset(f, 0, sizeof(f));
  memset(H, 0, sizeof(H));
  memset(H1, 0, sizeof(H1));
  memset(H2, 0, sizeof(H2));
  memset(strL, 0, sizeof(strL));
  memset(strR, 0, sizeof(strR));
  H1[0] = H2[0] = 1;
  for (int i = 1; i <= m; ++i)
    H1[i] = H1[i - 1] * 13131 % 998244353, H2[i] = H2[i - 1] * 233 % 1000000007;
  for (int k = 0; k < 2; ++k)
    for (int i = 1; i <= n; ++i) {
      H[k][i][i] = H[k][i][i] + a[k][i];
      for (int j = i + 1; j <= n; ++j)
        H[k][i][j] =
            Hash((H[k][i][j - 1].h1 + H1[j - i] * a[k][j]) % 998244353,
                 (H[k][i][j - 1].h2 + H2[j - i] * a[k][j]) % 1000000007);
      for (int j = i - 1; j >= 1; --j)
        H[k][i][j] =
            Hash((H[k][i][j + 1].h1 + H1[i - j] * a[k][j]) % 998244353,
                 (H[k][i][j + 1].h2 + H2[i - j] * a[k][j]) % 1000000007);
    }
  for (int i = 1; i <= m; ++i)
    strL[i] =
        Hash((strL[i - 1].h1 + H1[i - 1] * b[i] % 998244353) % 998244353,
             (strL[i - 1].h2 + H2[i - 1] * b[i] % 1000000007) % 1000000007);
  for (int i = m; i >= 1; --i) strR[i] = strR[i + 1] + b[i];
}
inline void add(long long int& x, long long int y) { x = (x + y) % 1000000007; }
inline void solve() {
  init();
  for (int i = 1; i <= n; ++i) {
    f[0][0][i - 1][0] = f[1][1][i - 1][0] = 1;
    for (int j = 0; j <= i * 2; ++j) {
      if (a[0][i] == b[j + 1]) {
        add(f[0][0][i][j + 1], f[0][0][i - 1][j]);
        add(f[1][0][i][j + 1], f[1][0][i - 1][j]);
      }
      if (a[0][i] == b[j + 1] && a[1][i] == b[j + 2]) {
        add(f[0][1][i][j + 2], f[0][0][i - 1][j]);
        add(f[1][1][i][j + 2], f[1][0][i - 1][j]);
      }
      if (a[1][i] == b[j + 1]) {
        add(f[0][1][i][j + 1], f[0][1][i - 1][j]);
        add(f[1][1][i][j + 1], f[1][1][i - 1][j]);
      }
      if (a[1][i] == b[j + 1] && a[0][i] == b[j + 2]) {
        add(f[0][0][i][j + 2], f[0][1][i - 1][j]);
        add(f[1][0][i][j + 2], f[1][1][i - 1][j]);
      }
    }
    for (int j = 2; j <= i; ++j) {
      Hash x = H[0][i][i - j + 1] + (H[1][i - j + 1][i] * j);
      if (2 * j <= m && x == strL[2 * j]) add(f[1][1][i][2 * j], 1);
      x = H[1][i][i - j + 1] + H[0][i - j + 1][i] * j;
      if (2 * j <= m && x == strL[2 * j]) add(f[0][0][i][2 * j], 1);
    }
    for (int j = 0; j <= m / 2 && i + j <= n; ++j) {
      if (j == 1) continue;
      Hash x = H[0][i + 1][i + j] + (H[1][i + j][i + 1] * j);
      if (j == 0) x = Hash(0, 0);
      if (x == strR[m - 2 * j + 1])
        add(ans, f[0][0][i][m - 2 * j] + f[1][0][i][m - 2 * j]);
      x = H[1][i + 1][i + j] + (H[0][i + j][i + 1] * j);
      if (j == 0) x = Hash(0, 0);
      if (x == strR[m - 2 * j + 1])
        add(ans, f[0][1][i][m - 2 * j] + f[1][1][i][m - 2 * j]);
    }
  }
}
inline void special1() {
  for (int i = 0; i < 2; ++i)
    for (int j = 1; j <= n; ++j)
      if (a[i][j] == b[1]) ++ans;
  cout << ans << endl;
}
inline void special2() {
  int dx[4] = {0, 1, 0, -1};
  int dy[4] = {-1, 0, 1, 0};
  for (int x = 0; x < 2; ++x)
    for (int y = 1; y <= n; ++y)
      for (int i = 0; i < 4; ++i) {
        int nx = x + dx[i], ny = y + dy[i];
        if (nx < 0 || 1 < nx || ny < 1 || n < ny) continue;
        if (a[x][y] == b[1] && a[nx][ny] == b[2]) ++ans;
      }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; ++i) a[0][i + 1] = s[i];
  cin >> s;
  for (int i = 0; i < n; ++i) a[1][i + 1] = s[i];
  cin >> s;
  m = s.size();
  for (int i = 0; i < m; ++i) b[i + 1] = s[i];
  if (m == 1) {
    special1();
    return 0;
  } else if (m == 2) {
    special2();
    return 0;
  }
  solve();
  for (int i = 1; i <= n / 2; ++i)
    swap(a[0][i], a[0][n - i + 1]), swap(a[1][i], a[1][n - i + 1]);
  solve();
  cout << ans << endl;
  return 0;
}
