#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int _n, n, m, f[N], g[N], ans[N];
long long Ans;
char s[N], t[N];
void kmp(char *s, int n, int *f) {
  int k = 0;
  f[1] = 0;
  for (int i = (2); i <= (n); i++) {
    while (k && s[k + 1] != s[i]) k = f[k];
    f[i] = (k += s[k + 1] == s[i]);
  }
}
void exkmp(char *s, int n, int *f) {
  int k = 1;
  for (int i = (2); i <= (n); i++) {
    f[i] = max(0, min(f[i - k + 1], k + f[k] - i));
    while (i + f[i] <= n && s[i + f[i]] == s[1 + f[i]]) f[i]++;
    if (i + f[i] > k + f[k]) k = i;
  }
  f[1] = n;
}
int main() {
  scanf("%s%s", t + 1, s + 1);
  _n = n = strlen(s + 1), m = strlen(t + 1);
  kmp(s, n, f);
  s[++n] = '#';
  for (int i = (1); i <= (m); i++) s[++n] = t[i];
  exkmp(s, n, g);
  for (int i = (_n + 3); i <= (n); i++) ans[g[i]]++;
  for (int i = _n; i >= 1; i--) ans[i] += ans[i + 1];
  Ans = (long long)_n * m;
  for (int i = (1); i <= (_n); i++)
    if (f[i]) Ans -= ans[i - f[i]];
  cout << Ans << '\n';
  return 0;
}
