#include <bits/stdc++.h>
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 = s.size();
  vector<int> z(n);
  int l = 0, r = 0;
  for (int i = 1; i < n; i++) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[i + z[i]] == s[z[i]]) z[i]++;
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
vector<int> pref_match(string s, string t) {
  int n = s.size(), m = t.size();
  s = s + "?" + t;
  vector<int> ret = z_function(s), z(m);
  for (int i = 0; i < m; i++) z[i] = ret[i + n + 1];
  return z;
}
vector<int> suff_match(string s, string t) {
  int n = s.size(), m = t.size();
  reverse(s.begin(), s.end());
  reverse(t.begin(), t.end());
  s = s + "?" + t;
  vector<int> ret = z_function(s), z(m);
  for (int i = 0; i < m; i++) z[i] = ret[i + n + 1];
  reverse(z.begin(), z.end());
  return z;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s1, s2;
  cin >> s1 >> s2;
  vector<int> pref = pref_match(s2, s1);
  int n = s1.size(), m = s2.size();
  vector<int> vals;
  for (int i = 1; i < n; i++) {
    vals.push_back(pref[i]);
  }
  sort(vals.begin(), vals.end());
  vector<int> kmp = prefix_function(s2);
  long long ans = 0;
  for (int i = 0; i < m; i++) {
    ans += n;
    if (kmp[i] == 0) continue;
    int x = i + 1 - kmp[i];
    int bad = upper_bound(vals.begin(), vals.end(), 1e9) -
              lower_bound(vals.begin(), vals.end(), x);
    ans -= bad;
  }
  cout << ans << endl;
  return 0;
}
