#include <bits/stdc++.h>
int main() {
  static char aa[3000 + 1], bb[3000 + 1];
  static int dp[3000 + 1][3000 + 1], dq[3000 + 1];
  int n, m, i, j, p, ans;
  scanf("%s%s", aa, bb), n = strlen(aa), m = strlen(bb);
  for (i = m - 1; i >= 0; i--)
    for (j = i; j < m; j++)
      if (i == j)
        dp[i][j] = bb[i] == aa[0] ? 2 : 0;
      else {
        char c = aa[j - i];
        dp[i][j] = bb[j] == c ? dp[i][j - 1] : 0;
        if (j < m - 1)
          dp[i][j] = (dp[i][j] + (bb[i] == c ? dp[i + 1][j] : 0)) % 998244353;
      }
  p = 1, ans = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m - 1; j++)
      if (aa[i] == bb[j]) dq[j] = (dq[j] + dq[j + 1]) % 998244353;
    if (i > 0 && aa[i] == bb[m - 1]) dq[m - 1] = (dq[m - 1] + p) % 998244353;
    if (i < m)
      dq[m - 1 - i] = (dq[m - 1 - i] + dp[m - 1 - i][m - 1]) % 998244353;
    p = p * 2 % 998244353;
    ans = (ans + dq[0]) % 998244353;
  }
  printf("%d\n", ans);
  return 0;
}
