#include <bits/stdc++.h>
using namespace std;
char s[((int)(2e5 + 5))], t[((int)(2e5 + 5))];
int match_t[((int)(2e5 + 5))], match_s[((int)(2e5 + 5))];
int z[((int)(2e5 + 5))];
void z_func(char s[]) {
  int l, r;
  z[0] = l = r = 0;
  for (int i = 1; s[i] != '\0'; i++) {
    if (r >= i) z[i] = min(r - i, z[i - l]);
    while (s[i + z[i]] != '\0' && s[z[i]] == s[i + z[i]]) z[i]++;
    z[i]--;
    if (z[i] + i > r) {
      r = z[i] + i;
      l = i;
    }
  }
}
int sum[((int)(2e5 + 5))], mx[((int)(2e5 + 5))];
int main() {
  scanf("%s %s", s, t);
  int n = strlen(t), m = strlen(s);
  z_func(t);
  for (int i = 0; i < n; i++) {
    match_t[i] = z[i] + i;
  }
  t[n] = '#';
  for (int i = 0; i < m; i++) {
    t[n + i + 1] = s[i];
  }
  t[n + m + 1] = '\0';
  z_func(t);
  for (int i = 0; i < m; i++) match_s[i] = z[n + 1 + i];
  sum[0] = 0;
  mx[0] = -1;
  for (int i = 1; i < n; i++) {
    int j = max(mx[i - 1] + 1, i);
    mx[i] = max(mx[i - 1], match_t[i]);
    sum[i] = sum[i - 1] + max(0, mx[i] - j + 1);
  }
  long long ans = n;
  for (int i = m - 1; i > 0; i--) {
    int j = match_s[i] + 1;
    if (j == n) j--;
    ans += n - sum[j];
  }
  printf("%lld\n", ans);
  return 0;
}
