#include <bits/stdc++.h>
using namespace std;
vector<int> prefixFunction(const string& s) {
  int n = s.size(), k = 0;
  vector<int> v(n + 1);
  v[1] = 0;
  for (int i = 2; i <= n; i++) {
    while (k > 0 && s[k] != s[i - 1]) k = v[k];
    if (s[k] == s[i - 1]) k++;
    v[i] = k;
  }
  return v;
}
vector<int> kmpMatcher(const string& text, const string& pattern) {
  vector<int> pi = prefixFunction(pattern);
  int matchCount = 0, k = 0;
  vector<int> rt(text.size());
  for (int i = 0; i < text.size(); i++) {
    while (k > 0 && text[i] != pattern[k]) k = pi[k];
    if (text[i] == pattern[k]) k++;
    rt[i] = k;
    if (k == pattern.size()) {
      matchCount++;
      k = pi[k];
    }
  }
  return rt;
}
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;
}
const int MAXN = 200007;
long long cu[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  string r = t + '#' + s;
  vector<int> z = z_function(r);
  for (int i = t.size() + 2; i < z.size(); i++) {
    cu[1]++;
    cu[z[i] + 1]--;
  }
  vector<int> pi = prefixFunction(t);
  long long ans = 0;
  for (int i = 1; i <= t.size(); i++) {
    cu[i] += cu[i - 1];
  }
  for (int i = 1; i <= t.size(); i++) {
    if (pi[i] == 0)
      ans += s.size();
    else
      ans += s.size() - cu[i - pi[i]];
  }
  cout << ans << endl;
  return 0;
}
