#include <bits/stdc++.h>
char s[100005], t[100005];
char a[200005];
int next[100005];
int lcp[200005];
int sum[100005];
void exkmp(char s[], int next[], int n) {
  int l = 1, r = 1;
  for (int i = 2; i <= n; i++) {
    if (i > r) {
      int p = 0;
      while (p + 1 <= n && i + p <= n && s[p + 1] == s[i + p]) p++;
      next[i] = p;
      l = i, r = i + p - 1;
    } else {
      int p = i - l + 1;
      if (next[p] < r - i + 1)
        next[i] = next[p];
      else {
        l = i;
        while (r + 1 <= n && s[r + 1] == s[r - l + 2]) r++;
        next[i] = r - l + 1;
      }
    }
  }
}
void kmp(char s[], int next[], int n) {
  next[1] = 0;
  for (int i = 2; i <= n; i++) {
    int j = next[i - 1];
    while (j > 0 && s[j + 1] != s[i]) j = next[j];
    if (s[j + 1] == s[i]) j++;
    next[i] = j;
  }
}
int max(int a, int b) { return a > b ? a : b; }
int main() {
  scanf("%s%s", s + 1, t + 1);
  int n = strlen(s + 1), m = strlen(t + 1);
  kmp(t, next, m);
  for (int i = 1; i <= m; i++) {
    if (next[i] != 0) {
      int cycle = i - next[i];
      sum[cycle]++;
    }
  }
  for (int i = 1; i <= m; i++) sum[i] += sum[i - 1];
  int size = 0;
  for (int i = 1; i <= m; i++) a[++size] = t[i];
  a[++size] = '.';
  for (int i = 1; i <= n; i++) a[++size] = s[i];
  exkmp(a, lcp, size);
  long long answer = 1ll * n * m;
  for (int i = 1; i <= n; i++) {
    int lp = lcp[i + 1 + m + 1];
    long long ban = sum[lp];
    answer -= ban;
  }
  printf("%lld\n", answer);
  return 0;
}
