#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,
                       const vector<int>& pi) {
  int matchCount = 0, k = 0;
  vector<int> ans(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++;
    ans[i] = k;
    if (k == pattern.size()) {
      matchCount++;
      k = pi[k];
    }
  }
  return ans;
}
const int N = 1e5 + 7;
int a[N];
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;
  }
  z[0] = n;
  return z;
}
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  vector<int> pi = prefixFunction(t);
  vector<int> z = z_function(t + '$' + s);
  for (int i = 2; i <= n; i++) {
    a[1]++;
    a[z[m + i] + 1]--;
  }
  for (int i = 1; i <= m; i++) {
    a[i] += a[i - 1];
  }
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int k = i - pi[i];
    ans += n;
    if (pi[i]) ans -= a[k];
  }
  cout << ans << endl;
}
