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 maxn = 2010;
template <int mod, int Base>
class String_Hasher {
 public:
  char buf[maxn];
  int v[maxn], p[maxn];
  inline void init() {
    v[0] = 0;
    p[0] = 1;
    int L = strlen(buf + 1);
    for (int i = 1; i <= L; i++) v[i] = (1ll * v[i - 1] * Base + buf[i]) % mod;
    for (int i = 1; i <= L; i++) p[i] = 1ll * p[i - 1] * Base % mod;
  }
  inline int query(int l, int r) {
    return (v[r] - 1ll * p[r - l + 1] * v[l - 1] % mod + mod) % mod;
  }
};
struct Hasher {
  char buf[maxn];
  int L;
  String_Hasher<1000000007, 1313131> H1;
  String_Hasher<1000000009, 1313131> H2;
  inline void init() {
    L = strlen(buf + 1);
    for (int i = 1; i <= L + 1; i++) H1.buf[i] = H2.buf[i] = buf[i];
    H1.init();
    H2.init();
  }
  inline pair<int, int> query(int l, int r) {
    return make_pair(H1.query(l, r), H2.query(l, r));
  }
  inline pair<int, int> queryrev(int l, int r) {
    l = L - l + 1, r = L - r + 1;
    if (l > r) swap(l, r);
    return query(l, r);
  }
} h[2], revh[2], hs;
char s[2][maxn], t[maxn];
const int mod = 1000000007;
inline void Add(int &a, int b) { a = a + b >= mod ? a + b - mod : a + b; }
int n, m;
int f[maxn][maxn][2];
inline int getans(int flag) {
  int res = 0;
  for (int i = 0; i < 2; i++) {
    memcpy(h[i].buf, s[i], sizeof(s[i]));
    memcpy(revh[i].buf, s[i], sizeof(s[i]));
    reverse(revh[i].buf + 1, revh[i].buf + n + 1);
    h[i].init();
    revh[i].init();
  }
  memset(f, 0, sizeof(f));
  for (int i = 0; i <= n; i++) f[i][0][0] = f[i][0][1] = 1;
  for (int l = 1; l < n; l++)
    for (int r = l + 1; r <= n; r++) {
      int len = r - l + 1;
      if ((len << 1) > m) continue;
      bool flag0 = 1, flag1 = 1;
      if (h[0].query(l, r) != hs.query(len + 1, len << 1)) flag0 = 0;
      if (revh[1].queryrev(l, r) != hs.query(1, len)) flag0 = 0;
      if (flag0) f[r][len << 1][0] = 1;
      if (revh[0].queryrev(l, r) != hs.query(1, len)) flag1 = 0;
      if (h[1].query(l, r) != hs.query(len + 1, len << 1)) flag1 = 0;
      if (flag1) f[r][len << 1][1] = 1;
      if ((len << 1) == m) {
        if (flag0) res++;
        if (flag1) res++;
      }
    }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      if (t[j + 1] == s[0][i + 1]) Add(f[i + 1][j + 1][0], f[i][j][0]);
      if (t[j + 1] == s[1][i + 1]) Add(f[i + 1][j + 1][1], f[i][j][1]);
      if (j < m - 1 && t[j + 1] == s[0][i + 1] && t[j + 2] == s[1][i + 1])
        Add(f[i + 1][j + 2][1], f[i][j][0]);
      if (j < m - 1 && t[j + 1] == s[1][i + 1] && t[j + 2] == s[0][i + 1])
        Add(f[i + 1][j + 2][0], f[i][j][1]);
    }
  int ans = 0;
  for (int i = 1; i <= n; i++) Add(ans, (f[i][m][0] + f[i][m][1]) % mod);
  for (int l = 1; l < n; l++)
    for (int r = l + 1; r <= n; r++) {
      int len = r - l + 1;
      if ((len << 1) > m) continue;
      int st = (m - (len << 1));
      bool flag0 = 1, flag1 = 1;
      if (h[0].query(l, r) != hs.query(st + 1, st + len)) flag0 = 0;
      if (revh[1].queryrev(l, r) != hs.query(st + len + 1, st + (len << 1)))
        flag0 = 0;
      if (flag0) Add(ans, f[l - 1][m - (len << 1)][0]);
      if (revh[0].queryrev(l, r) != hs.query(st + len + 1, st + (len << 1)))
        flag1 = 0;
      if (h[1].query(l, r) != hs.query(st + 1, st + len)) flag1 = 0;
      if (flag1) Add(ans, f[l - 1][m - (len << 1)][1]);
      if ((len << 1) == m) {
        if (flag0) res++;
        if (flag1) res++;
      }
    }
  if (flag) return res;
  return ans;
}
int main() {
  scanf("%s%s", s[0] + 1, s[1] + 1);
  scanf("%s", t + 1);
  n = strlen(s[0] + 1);
  m = strlen(t + 1);
  if (m == 1) {
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (s[0][i] == t[1]) ans++;
      if (s[1][i] == t[1]) ans++;
    }
    printf("%d\n", ans);
    return 0;
  }
  if (m == 2) {
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (s[0][i] == t[1] && s[1][i] == t[2]) ans++;
      if (s[1][i] == t[1] && s[0][i] == t[2]) ans++;
    }
    for (int i = 1; i < n; i++) {
      if (s[0][i] == t[1] && s[0][i + 1] == t[2]) ans++;
      if (s[1][i] == t[1] && s[1][i + 1] == t[2]) ans++;
      if (s[0][i] == t[2] && s[0][i + 1] == t[1]) ans++;
      if (s[1][i] == t[2] && s[1][i + 1] == t[1]) ans++;
    }
    printf("%d\n", ans);
    return 0;
  }
  memcpy(hs.buf, t, sizeof(t));
  hs.init();
  int ans = getans(0);
  reverse(s[0] + 1, s[0] + n + 1);
  reverse(s[1] + 1, s[1] + n + 1);
  Add(ans, getans(0));
  Add(ans, mod - getans(1));
  printf("%d\n", ans);
}