#include <bits/stdc++.h>   using namespace std;   const int mo = 1000000007;   char S[2005], A[2][2005];   int ans, n, m, P[2][2005][2005], Q[2][2005][2005];   long long H[2005], w[2][2005], W[2005], N[2005];   bool IS(int u, int p, int q, int l, int r) {     return (w[u][q] - w[u][p - 1]) * H[2000 - p] ==            (W[r] - W[l - 1]) * H[2000 - l];   }   bool NS(int u, int p, int q, int l, int r) {     return (w[u][q] - w[u][p - 1]) * H[2000 - p] ==            (N[l] - N[r + 1]) * H[1999 - m + r];   }   int main() {     scanf( %s , A[0] + 1);     scanf( %s , A[1] + 1);     n = strlen(A[0] + 1);     scanf( %s , S + 1);     m = strlen(S + 1);     H[0] = 1;     for (int i = 1; i <= 2000; ++i) H[i] = H[i - 1] * 29;     for (int i = 1; i <= n; ++i) {       w[0][i] = w[0][i - 1] + 1ll * (A[0][i] -  a ) * H[i];       w[1][i] = w[1][i - 1] + 1ll * (A[1][i] -  a ) * H[i];     }     for (int i = 1; i <= m; ++i) W[i] = W[i - 1] + 1ll * (S[i] -  a ) * H[i];     for (int i = m; i >= 1; --i)       N[i] = N[i + 1] + 1ll * (S[i] -  a ) * H[m - i + 1];     for (int u = 0; u < 2; ++u)       for (int i = 0; i <= n + 1; ++i) P[u][i][m + 1] = Q[u][i][m + 1] = 1;     for (int i = n; i; --i)       for (int j = 1; j <= m; ++j)         for (int u = 0, v = 1; u < 2; ++u, v = 0)           if (A[u][i] == S[j]) {             P[u][i][j] = P[u][i + 1][j + 1];             if (A[v][i] == S[j + 1]) (P[u][i][j] += P[v][i + 1][j + 2]) %= mo;             if ((m - j + 1) % 2 == 0 && m - j + 1 <= (n - i + 1) * 2) {               int x = m - j + 1 >> 1;               if (x > 1 && IS(u, i, i + x - 1, j, j + x - 1) &&                   NS(v, i, i + x - 1, j + x, m))                 (++P[u][i][j]) %= mo;             }           }     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j)         for (int u = 0, v = 1; u < 2; ++u, v = 0)           if (A[u][i] == S[j]) {             Q[u][i][j] = Q[u][i - 1][j + 1];             if (A[v][i] == S[j + 1]) (Q[u][i][j] += Q[v][i - 1][j + 2]) %= mo;             if ((m - j + 1) % 2 == 0 && m - j + 1 <= i * 2) {               int x = m - j + 1 >> 1;               if (x > 1 && NS(u, i - x + 1, i, j, j + x - 1) &&                   IS(v, i - x + 1, i, j + x, m))                 (++Q[u][i][j]) %= mo;             }           }     for (int i = 1; i <= n; ++i)       for (int u = 0, v = 1; u < 2; ++u, v = 0)         if (A[u][i] == S[1]) {           if (m == 1) {             ++ans;             continue;           }           if (A[v][i] == S[2])             if (m == 2)               ++ans;             else               (ans += (P[v][i + 1][3] + Q[v][i - 1][3]) % mo) %= mo;           for (int j = 2; j <= m && j <= n - i + 1; ++j) {             if (!IS(u, i, i + j - 1, 1, j)) break;             if (j == m) {               (++ans) %= mo;               break;             }             if (A[v][i + j - 1] != S[j + 1]) continue;             if (j + 1 == m) {               (++ans) %= mo;               continue;             }             if (j * 2 <= m) {               if (NS(v, i, i + j - 1, j + 1, j * 2))                 (ans += Q[v][i - 1][j * 2 + 1]) %= mo;             } else if (NS(v, i + j - m + j, i + j - 1, j + 1, m))               (++ans) %= mo;             (ans += P[v][i + j][j + 2]) %= mo;           }           for (int j = 2; j <= m && j <= i; ++j) {             if (!NS(u, i - j + 1, i, 1, j)) break;             if (j == m) {               (++ans) %= mo;               break;             }             if (A[v][i - j + 1] != S[j + 1]) continue;             if (j + 1 == m) {               (++ans) %= mo;               continue;             }             if (j * 2 <= m) {               if (IS(v, i - j + 1, i, j + 1, j * 2))                 (ans += P[v][i + 1][j * 2 + 1]) %= mo;             } else if (IS(v, i - j + 1, i - j + m - j, j + 1, m))               (++ans) %= mo;             (ans += Q[v][i - j][j + 2]) %= mo;           }         }     printf( %d n , ans);     return 0;   }