#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 7;
int n, m;
char s[N], t[N];
int cnt[N];
int f[N];
vector<int> Zalgo(string &s) {
  vector<int> v(1, s.size());
  for (int i = 1, l = -1, r = -1; i < s.size(); i++) {
    if (i <= r && v[i - l] < r - i + 1)
      v.push_back(v[i - l]);
    else {
      l = i;
      r = (i > r) ? i : (r + 1);
      while (r < s.size() && s[r - i] == s[r]) r++;
      v.push_back((r--) - l);
    }
  }
  v.push_back(0);
  return v;
}
void getNext(char *s, int n) {
  f[0] = 0;
  f[1] = 0;
  for (int i = 1; i < n; i++) {
    int j = f[i];
    while (j && s[i] != s[j]) j = f[j];
    f[i + 1] = (s[i] == s[j] ? j + 1 : 0);
  }
  for (int i = 2; i <= n; i++) {
    if (f[i] > 0) cnt[i - f[i]]++;
  }
}
int main() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
  getNext(t + 1, m);
  for (int i = 1; i <= m; i++) cnt[i] += cnt[i - 1];
  string S;
  for (int i = 1; i <= m; i++) S.push_back(t[i]);
  S.push_back('$');
  for (int i = 1; i <= n; i++) S.push_back(s[i]);
  vector<int> lcp = Zalgo(S);
  long long ans = 1LL * n * m;
  for (int i = 2; i <= n; i++) {
    ans -= cnt[lcp[i + m]];
  }
  printf("%lld\n", ans);
  return 0;
}
