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 N = 2005, P = 1000000007, B = 131;
using ll = unsigned long long;
ll hs1[3][N], hs2[3][N], ht[N], pw[N], ans, gs, f[3][N][N], g[3][N][N];
int n, m;
char s[3][N], t[N];
inline ll g1(int l, int r, int t) {
  return hs1[t][r] - hs1[t][l - 1] * pw[r - l + 1];
}
inline ll g2(int l, int r, int t) {
  return hs2[t][l] - hs2[t][r + 1] * pw[r - l + 1];
}
inline void add(ll &x, ll y) { x = (x + y) % P; }
inline ll merge(ll h1, ll h2, int len) { return h2 + h1 * pw[len]; }
void dp() {
  memset(f, 0, sizeof(f));
  memset(g, 0, sizeof(g));
  for (int i = 1; i <= m; i++) ht[i] = (ht[i - 1] * B + (t[i] - 'a' + 1));
  for (int i = 1; i < 3; i++)
    for (int j = 1; j <= n; j++)
      for (int k = j; k > 0; --k) {
        int len = 2 * (j - k + 1);
        if (len > m) continue;
        ll ha = g1(k, j, i), hb = g2(k, j, 3 - i), hh = ht[len];
        if (merge(hb, ha, j - k + 1) == hh) {
          if (len == m)
            ++gs;
          else
            g[i][j][len] = 1;
        }
      }
  for (int i = 1; i < 3; i++)
    for (int j = 1; j <= n; j++)
      if (s[i][j] == t[1]) g[i][j][1] = 1;
  for (int i = m; i > 0; --i) ht[i] = (ht[i + 1] * B + (t[i] - 'a' + 1));
  for (int k = 1; k < m; k++)
    for (int j = 1; j <= n; j++)
      for (int i = 1; i < 3; i++) {
        if (g[i][j][k] && j < n && s[i][j + 1] == t[k + 1])
          add(f[i][j + 1][k + 1], g[i][j][k]);
        if (f[i][j][k]) {
          if (j < n && s[i][j + 1] == t[k + 1])
            add(f[i][j + 1][k + 1], f[i][j][k]);
          if (s[3 - i][j] == t[k + 1]) add(g[3 - i][j][k + 1], f[i][j][k]);
        }
      }
  for (int i = 1; i < 3; i++)
    for (int j = 1; j <= n; j++) {
      if (s[i][j] == t[m]) {
        if (m == 1) add(ans, 1);
        add(ans, f[i][j - 1][m - 1]);
        add(ans, g[i][j - 1][m - 1]);
      }
      for (int k = j; k <= n; k++) {
        int len = 2 * (k - j + 1);
        if (len > m) continue;
        ll ha = g1(j, k, 3 - i), hb = g2(j, k, i), hh = ht[m - len + 1];
        if (merge(ha, hb, k - j + 1) == hh) {
          if (len == m && m != 2)
            ++gs;
          else
            add(ans, f[i][j - 1][m - len]), add(ans, g[i][j - 1][m - len]);
        }
      }
    }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> (s[1] + 1) >> (s[2] + 1);
  n = strlen(s[1] + 1);
  cin >> (t + 1);
  m = strlen(t + 1);
  pw[0] = 1;
  int lim = max(n, m);
  for (int i = 1; i <= lim; i++) pw[i] = pw[i - 1] * B;
  for (int i = 1; i < 3; i++)
    for (int j = 1; j <= n; j++)
      hs1[i][j] = hs1[i][j - 1] * B + (s[i][j] - 'a' + 1);
  for (int i = 1; i < 3; i++)
    for (int j = n; j > 0; j--)
      hs2[i][j] = hs2[i][j + 1] * B + (s[i][j] - 'a' + 1);
  dp();
  reverse(t + 1, t + m + 1);
  dp();
  add(ans, gs / 2);
  if (m == 1) ans /= 2;
  cout << ans << endl;
  return 0;
}