#include <bits/stdc++.h>
const int INF = 2000000005;
const long long BIG_INF = 2000000000000000005;
const int mod = 1000000007;
const int P = 31;
const long double PI = 3.141592653589793238462643;
const double eps = 1e-9;
using namespace std;
vector<pair<int, int> > dir = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
bool valid(int x, int y, int n, int m) {
  return x >= 0 && y >= 0 && x < n && y < m;
}
mt19937 rng(1999999973);
const int N = 200000 + 50;
string s, t;
int pref[N], bal[N], z[N], n;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> s >> t;
  long long ans = (long long)t.size() * (long long)s.size();
  n = t.size();
  s = t + '#' + s;
  for (int i = 1; i < n; i++) {
    int k = pref[i - 1];
    while (k > 0 && t[k] != t[i]) k = pref[k - 1];
    if (s[i] == s[k]) pref[i] = k + 1;
    if (pref[i] > 0) bal[i + 1 - pref[i]]++;
  }
  int l, r = 0;
  z[0] = INF;
  for (int i = 1; i < s.size(); i++) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (i + z[i] < s.size() && s[z[i]] == s[i + z[i]]) z[i]++;
    if (z[i] + i - 1 > r) {
      r = z[i] + i - 1;
      l = i;
    }
  }
  for (int i = 1; i <= n; i++) {
    bal[i] += bal[i - 1];
  }
  for (int i = n + 1; i < s.size() - 1; i++) {
    ans -= (long long)bal[z[i + 1]];
  }
  cout << ans;
  return 0;
}
