#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 5;
int n, m;
long long ans;
int fail[maxN], cnt[maxN];
char S[maxN], T[maxN];
int main() {
  cin >> (S + 1) >> (T + 1);
  n = strlen(S + 1), m = strlen(T + 1);
  for (int i = 2, j = 0; i <= m; ++i) {
    while (j and T[j + 1] != T[i]) j = fail[j];
    j += (T[j + 1] == T[i]);
    fail[i] = j;
  }
  for (int i = 1, j = 0; i <= n; ++i) {
    while (j and T[j + 1] != S[i]) j = fail[j];
    j += (T[j + 1] == S[i]);
    if (j < i)
      ++cnt[j];
    else
      ++cnt[fail[j]];
  }
  for (int i = m; i; --i) cnt[fail[i]] += cnt[i];
  (ans = n) *= m;
  for (int i = 1; i <= m; ++i)
    if (fail[i] and i - fail[i] > 0) ans -= cnt[i - fail[i]];
  cout << ans << endl;
  return 0;
}
