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 long long b = 2741;
const long long mod = 923242909;
const long long AMOD = 1e9 + 7;
const int N = 2020;
long long bpow[N], ibpow[N];
long long pre[2][N], suf[2][N];
long long tpre[N];
char s[2][N], t[N];
int n, m;
long long modpow(long long b, long long p, long long m = mod) {
  long long ans = 1;
  for (; p; p /= 2, b = b * b % m) {
    if (p & 1) ans = ans * b % m;
  }
  return ans;
}
void setup() {
  ibpow[0] = bpow[0] = 1;
  ibpow[1] = modpow(b, mod - 2);
  for (int i = 1; i < N; ++i) {
    bpow[i] = bpow[i - 1] * b % mod;
    ibpow[i] = ibpow[i - 1] * ibpow[1] % mod;
  }
}
void prep_hash() {
  for (int z = 0; z < 2; ++z) {
    pre[z][0] = 0;
    for (int i = 1; i <= n; ++i) {
      pre[z][i] = (pre[z][i - 1] * b + s[z][i - 1]) % mod;
    }
    suf[z][n] = 0;
    for (int i = n - 1; i >= 0; --i) {
      suf[z][i] = (suf[z][i + 1] * b + s[z][i]) % mod;
    }
  }
  for (int i = 1; i <= m; ++i) {
    tpre[i] = (tpre[i - 1] * b + t[i - 1]) % mod;
  }
}
long long forward_hash(int z, int i, int j) {
  return (pre[z][j] - bpow[j - i] * pre[z][i] % mod + mod) % mod;
}
long long backward_hash(int z, int i, int j) {
  return (suf[z][i] - suf[z][j] * bpow[j - i] % mod + mod) % mod;
}
long long t_hash(int i, int j) {
  return (tpre[j] - tpre[i] * bpow[j - i] % mod + mod) % mod;
}
long long f[N][2][N], g[N][2][N], dp[N][2][N];
void gen_fg() {
  memset(f, 0, sizeof f);
  memset(g, 0, sizeof g);
  g[n][0][m] = g[n][1][m] = 1;
  for (int i = 0; i < n; ++i) {
    g[i][0][m] = g[i][1][m] = 1;
    f[i][0][0] = f[i][1][0] = 1;
    for (int j = 1; i - j + 1 >= 0 && 2 * j <= m; ++j) {
      {
        long long xh = backward_hash(0, i + 1 - j, i + 1) * bpow[j] +
                       forward_hash(1, i + 1 - j, i + 1);
        xh %= mod;
        if (xh == t_hash(0, j * 2)) {
          f[i][1][j * 2] = 1;
        }
      }
      {
        long long xh = backward_hash(1, i + 1 - j, i + 1) * bpow[j] +
                       forward_hash(0, i + 1 - j, i + 1);
        xh %= mod;
        if (xh == t_hash(0, j * 2)) {
          f[i][0][j * 2] = 1;
        }
      }
    }
    for (int j = 2; i + j - 1 < n && 2 * j <= m; ++j) {
      {
        long long xh =
            forward_hash(0, i, i + j) * bpow[j] + backward_hash(1, i, i + j);
        xh %= mod;
        if (xh == t_hash(m - 2 * j, m)) {
          g[i][0][m - j * 2] = 1;
        }
      }
      {
        long long xh =
            forward_hash(1, i, i + j) * bpow[j] + backward_hash(0, i, i + j);
        xh %= mod;
        if (xh == t_hash(m - 2 * j, m)) {
          g[i][1][m - j * 2] = 1;
        }
      }
    }
    for (int j = 0; j <= m; ++j) {
    }
  }
}
long long solve(const string &r1, const string &r2, const string &goal) {
  for (int i = 0; i < r1.size(); ++i) {
    s[0][i] = r1[i];
    s[1][i] = r2[i];
  }
  for (int i = 0; i < goal.size(); ++i) {
    t[i] = goal[i];
  }
  prep_hash();
  gen_fg();
  memset(dp, 0, sizeof dp);
  for (int i = 0; i < n; ++i) {
    dp[i][0][0] = dp[i][1][0] = 1;
    for (int j = 1; j <= m; ++j) {
      dp[i][0][j] = f[i][0][j];
      dp[i][1][j] = f[i][1][j];
    }
  }
  long long ans = 0;
  if (s[0][0] == t[0]) {
    dp[0][0][1] = 1;
  }
  if (s[1][0] == t[0]) {
    dp[0][1][1] = 1;
  }
  ans += g[0][0][0] % AMOD;
  ans += g[0][1][0] % AMOD;
  for (int j = 0; j <= m; ++j) {
    ans += dp[0][0][j] * g[1][0][j] % AMOD;
    ans += dp[0][1][j] * g[1][1][j] % AMOD;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[0][i] == t[j - 1]) {
        dp[i][0][j] += dp[i - 1][0][j - 1];
      }
      if (s[1][i] == t[j - 1]) {
        dp[i][1][j] += dp[i - 1][1][j - 1];
      }
      if (j > 2 && s[0][i] == t[j - 2] && s[1][i] == t[j - 1]) {
        dp[i][1][j] += dp[i - 1][0][j - 2];
      }
      if (j > 2 && s[1][i] == t[j - 2] && s[0][i] == t[j - 1]) {
        dp[i][0][j] += dp[i - 1][1][j - 2];
      }
      dp[i][0][j] %= AMOD;
      dp[i][1][j] %= AMOD;
      ans += dp[i][0][j] * g[i + 1][0][j] % AMOD;
      ans += dp[i][1][j] * g[i + 1][1][j] % AMOD;
    }
    ans += dp[i][0][0] * g[i + 1][0][0] % AMOD;
    ans += dp[i][1][0] * g[i + 1][1][0] % AMOD;
  }
  if (m == 4) {
    for (int i = 0; i < n - 1; ++i) {
      ans += AMOD - f[i][0][2] * g[i + 1][0][2] - f[i][1][2] * g[i + 1][1][2];
      ans %= AMOD;
    }
  }
  return ans % AMOD;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  setup();
  string r1, r2, goal;
  cin >> r1 >> r2 >> goal;
  n = r1.size();
  m = goal.size();
  string rgoal = goal;
  reverse(rgoal.begin(), rgoal.end());
  long long ans = solve(r1, r2, goal);
  reverse(r1.begin(), r1.end());
  reverse(r2.begin(), r2.end());
  ans += solve(r2, r1, goal);
  if (goal.size() % 2 == 0) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j <= goal.size(); j += goal.size()) {
        ans += AMOD * 2 - f[i][0][j] * g[i + 1][0][j] -
               f[i][1][j] * g[i + 1][1][j];
        ans %= AMOD;
      }
    }
    ans += AMOD * 2 - g[0][0][0] - g[0][1][0];
    ans %= AMOD;
  }
  if (goal.size() == 1) {
    ans = ans * modpow(2, AMOD - 2, AMOD) % AMOD;
  }
  cout << ans % AMOD << "\n";
  return 0;
}
