#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
using namespace std;
vector<int> prefix_function(string s) {
  int n = (int)s.length();
  vector<int> pi(n);
  for (int i = 1; i < n; ++i) {
    int j = pi[i - 1];
    while (j > 0 && s[i] != s[j]) j = pi[j - 1];
    if (s[i] == s[j]) ++j;
    pi[i] = j;
  }
  return pi;
}
vector<int> z_function(string s) {
  int n = (int)s.length();
  vector<int> z(n);
  for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
long long cnt[200001];
long long fnt[200001];
int t[200001];
void inc(int pos, int val) {
  for (; pos < 200001; pos += (pos & -pos)) t[pos] += val;
}
int sum(int r) {
  int ans = 0;
  for (; r > 0; r -= (r & -r)) ans += t[r];
  return ans;
}
signed main() {
  string s, t;
  cin >> s >> t;
  long long n = s.length(), m = t.length();
  vector<int> pr = prefix_function(t);
  string ns = t + '#' + s;
  vector<int> p2 = z_function(ns);
  for (int i = 1; i < m; i++) {
    if (i - pr[i] + 1 <= i) ++cnt[i - pr[i] + 1];
  }
  for (int i = 2; i <= n; i++) {
    inc(1, 1);
    inc(p2[i + m] + 1, -1);
  }
  long long ans = n * m;
  for (int i = 1; i <= m + n; i++) ans -= sum(i) * cnt[i];
  cout << ans;
  set<string> st;
  return 0;
}
