#include <bits/stdc++.h>
using namespace std;
vector<int> calcpi(string s) {
  vector<int> pi(s.size(), 0);
  int k = 0;
  for (int i = 1; i < s.size(); ++i) {
    while (k > 0 and s[k] != s[i]) k = pi[k - 1];
    if (s[k] == s[i]) ++k;
    pi[i] = k;
  }
  return pi;
}
vector<int> calcz(string s) {
  int n = s.size();
  vector<int> z(n, 0);
  int L = 0, R = 0;
  for (int i = 1; i < n; i++) {
    if (i > R) {
      L = R = i;
      while (R < n && s[R - L] == s[R]) R++;
      z[i] = R - L;
      R--;
    } else {
      int k = i - L;
      if (z[k] < R - i + 1)
        z[i] = z[k];
      else {
        L = i;
        while (R < n && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
  return z;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  vector<int> p1 = calcz(t + "$" + s);
  vector<int> add(t.size() + 1, 0);
  for (int i = t.size() + 2; i < int(p1.size()); ++i) {
    add[p1[i]]++;
  }
  cerr << "hmm " << t.size() * s.size() << endl;
  long long ans = 0;
  vector<int> p2 = calcpi(t);
  long long sum = 0;
  for (int i = t.size() - 1; i >= 0; --i) {
    add[i] = add[i] + add[i + 1];
  }
  for (int i = t.size() - 1; i >= 0; --i) {
    int siz = (i + 1) - p2[i];
    if (siz != i + 1)
      ans += s.size() - add[siz];
    else
      ans += s.size();
  }
  cout << ans << endl;
}
