#include <bits/stdc++.h>
using namespace std;
const int N = 3000 + 10, mod = 998244353;
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int f[N][N], g[N][N], pw[N];
char s[N], t[N];
int main() {
  pw[0] = 1;
  for (int i = 1; i < N; i++) pw[i] = pw[i - 1] * 2ll % mod;
  ios::sync_with_stdio(0);
  cin >> (s + 1) >> (t + 1);
  int n = strlen(s + 1), m = strlen(t + 1);
  for (int i = m; i >= 1; i--) {
    for (int j = i; j <= m; j++) {
      if (i == j) f[i][j] = (t[i] == s[1]) * 2;
      if (j + 1 <= m && t[j + 1] == s[j - i + 2]) add(f[i][j + 1], f[i][j]);
      if (i - 1 >= 1 && t[i - 1] == s[j - i + 2]) add(f[i - 1][j], f[i][j]);
    }
  }
  for (int i = 1; i <= n + 1; i++) g[i][0] = n - i + 2;
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= m; j++) {
      g[i][j] = g[i + 1][j];
      if (s[i] == t[j]) add(g[i][j], g[i + 1][j - 1]);
    }
  }
  int ans = 0;
  for (int i = 2; i <= n; i++)
    if (s[i] == t[m]) {
      add(ans, int(1ll * g[i + 1][m - 1] * pw[i - 1] % mod));
    }
  for (int i = 1; i <= m; i++) {
    if (i == m)
      add(ans, int(1ll * f[1][m] * (n - m + 1) % mod));
    else
      add(ans, int(1ll * g[i + 2][m - i] * f[m - i + 1][m] % mod));
  }
  cout << ans << endl;
}
