#include <bits/stdc++.h>
using namespace std;
vector<int> lps(string& str) {
  int n = str.size();
  vector<int> ans(n + 1);
  int i = 1;
  int l = 0;
  while (i < n) {
    if (str[i] == str[l]) {
      ans[++i] = ++l;
      continue;
    }
    if (l > 0) {
      l = ans[l];
      continue;
    }
    ans[++i] = 0;
  }
  return ans;
}
vector<int> z_alg(string& s) {
  int n = s.size();
  int l = 0;
  int r = 0;
  vector<int> z(n);
  for (int i = 1; i < n; i++) {
    if (i < r) z[i] = min(r - i, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++;
    if (i + z[i] > r) {
      r = i + z[i];
      l = i;
    }
  }
  return z;
}
int bin_sea(int a, int b, vector<int>& lps) {
  if (a == b) return a;
  int mid = (a + b + 1) / 2;
  if (lps[mid + 1] == mid)
    return bin_sea(mid, b, lps);
  else
    return bin_sea(a, mid - 1, lps);
}
vector<int> lps_alg(string& s) {
  int n = s.size();
  vector<int> psv = lps(s);
  vector<int> z(n);
  for (int i = 1; i < n; i++) {
    int j = 0;
    if (z[i - 1] > 1) j = bin_sea(0, z[i - 1] - 1, psv);
    while (s[i + j] == s[j]) j++;
    z[i] = j;
  }
  return z;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s, t;
  cin >> s >> t;
  vector<int> lps_t = lps(t);
  string ts = t + '$' + s;
  vector<int> z = lps_alg(ts);
  vector<int> match(s.size(), 0);
  for (int i = 1; i < (int)s.size(); i++) {
    match[z[t.size() + 1 + i]]++;
  }
  for (int i = s.size() - 1; i > 0; i--) match[i - 1] += match[i];
  long long acc = 0;
  for (int i = 1; i <= (int)t.size(); i++) {
    acc += s.size();
    if (lps_t[i] > 0 && i - lps_t[i] < (int)s.size()) {
      acc -= match[i - lps_t[i]];
    }
  }
  cout << acc << '\n';
  return 0;
}
