#include <bits/stdc++.h>
using namespace std;
const int maxr = 10000000;
char str[maxr], prt[maxr];
int rpos, ppos, mmx;
inline char readc() {
  if (!rpos) mmx = fread(str, 1, maxr, stdin);
  char c = str[rpos++];
  if (rpos == maxr) rpos = 0;
  if (rpos > mmx) return 0;
  return c;
}
template <typename T>
inline void read(T &x) {
  x = 0;
  register int flag = 1, c;
  while (((c = readc()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    flag = -1;
  else
    x = c - '0';
  while ((c = readc()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= flag;
}
inline int reads(char *s) {
  register int len = 0, c;
  while (isspace(c = readc()) || !c)
    ;
  s[len++] = c;
  while (!isspace(c = readc()) && c) s[len++] = c;
  s[len] = 0;
  return len;
}
inline void printc(char c) {
  prt[ppos++] = c;
  if (ppos == maxr) fwrite(prt, 1, ppos, stdout), ppos = 0;
}
inline void prints(char *s) {
  for (int i = 0; s[i]; i++) printc(s[i]);
}
template <typename T>
inline void print(T x, char c = '\n') {
  if (x < 0) printc('-'), x = -x;
  if (x) {
    static char sta[20];
    register int tp = 0;
    for (; x; x /= 10) sta[tp++] = x % 10 + '0';
    while (tp > 0) printc(sta[--tp]);
  } else
    printc('0');
  printc(c);
}
const int maxn = 200005;
char S[maxn], T[maxn], A[maxn];
int z[maxn], lp[maxn], sum[maxn];
int main() {
  int n = reads(S), m = reads(T);
  for (int i = 0; i < m; i++) A[i] = T[i];
  A[m] = '$';
  for (int i = 0; i < n; i++) A[m + i + 1] = S[i];
  for (int i = 1, j = 0, id = 0; i <= n + m; i++) {
    if (j > i) z[i] = min(j - i, z[i - id]);
    while (i + z[i] <= n + m && A[z[i]] == A[i + z[i]]) ++z[i];
    if (i + z[i] > j) {
      for (int k = j; k < i + z[i] && k < m; k++) lp[k] = i;
      j = i + z[i], id = i;
    }
  }
  for (int i = 1; i < m; i++) sum[i] = sum[i - 1] + (lp[i] <= i);
  long long res = 0;
  for (int i = 0; i < n; i++) {
    int t = upper_bound(lp, lp + m, z[i + m + 2]) - lp;
    res += m - (t ? sum[t - 1] : 0);
  }
  print(res);
  fwrite(prt, 1, ppos, stdout);
  return 0;
}
