#include <bits/stdc++.h>
using namespace std;
const int md1 = 1004535809, md2 = 167772161, base1 = 19260817, base2 = 11451401;
char s[100005], t[100005];
int fail[100005], ls, lt, _1[100005], _2[100005];
long long ans;
pair<int, int> hs[100005], ht[100005];
void init() {
  for (int i = *_1 = *_2 = 1; i <= 100000; ++i)
    _1[i] = _1[i - 1] * (long long)base1 % md1,
    _2[i] = _2[i - 1] * (long long)base2 % md2;
  for (int i = 1; i <= ls; ++i)
    hs[i] = make_pair((hs[i - 1].first * (long long)base1 + s[i]) % md1,
                      (hs[i - 1].second * (long long)base2 + s[i]) % md2);
  for (int i = 1; i <= lt; ++i)
    ht[i] = make_pair((ht[i - 1].first * (long long)base1 + t[i]) % md1,
                      (ht[i - 1].second * (long long)base2 + t[i]) % md2);
}
inline bool check(int beg, int len) {
  pair<int, int> hx1 =
      make_pair((hs[beg + len - 1].first -
                 hs[beg - 1].first * (long long)_1[len] % md1 + md1) %
                    md1,
                (hs[beg + len - 1].second -
                 hs[beg - 1].second * (long long)_2[len] % md2 + md2) %
                    md2);
  pair<int, int> hx2 = ht[len];
  return hx1 == hx2;
}
inline int LCP(int beg) {
  int l = 1, r = min(lt, ls - beg + 1), ans = 0;
  while (l <= r) {
    const int mid = l + r >> 1;
    if (check(beg, mid))
      l = (ans = mid) + 1;
    else
      r = mid - 1;
  }
  return ans;
}
int buc[100005];
int main() {
  scanf("%s%s", s + 1, t + 1);
  ls = strlen(s + 1), lt = strlen(t + 1);
  fail[1] = 0;
  for (int i = 2, j = 0; i <= lt; ++i) {
    while (j && t[j + 1] != t[i]) j = fail[j];
    if (t[j + 1] == t[i]) ++j;
    fail[i] = j;
  }
  for (int i = 1; i <= lt; ++i)
    if (fail[i]) ++buc[i - fail[i]];
  for (int i = 1; i <= lt; ++i) buc[i] += buc[i - 1];
  ans = ls * (long long)lt;
  init();
  for (int i = 1; i <= ls; ++i) {
    int lcp = LCP(i + 1);
    ans -= buc[lcp];
  }
  printf("%lld\n", ans);
  return 0;
}
