#include <bits/stdc++.h>
using namespace std;
vector<int> zalgo(string s) {
  int n = s.size(), l = 0, r = 0;
  vector<int> z(n);
  z[0] = n;
  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 {
      if (z[i - l] <= r - i)
        z[i] = z[i - l];
      else {
        l = i;
        while (r < n && s[r - l] == s[r]) ++r;
        z[i] = r - l;
        --r;
      }
    }
  }
  return z;
}
vector<int> getBorders(string s) {
  int n = s.size();
  vector<int> b(n);
  b[0] = 0;
  for (int i = 1; i < n; ++i) {
    int pre = b[i - 1];
    while (pre && s[pre] != s[i]) pre = b[pre - 1];
    if (s[pre] == s[i]) ++pre;
    b[i] = pre;
  }
  return b;
}
char ss[100005], tt[100005];
int main() {
  scanf("%s%s", ss, tt);
  string s(ss), t(tt);
  string ts = t + "$" + s;
  auto z = zalgo(t);
  auto b = getBorders(ts);
  int n = s.size(), m = t.size();
  vector<int> maxz(m + 1);
  for (int i = 1; i <= m; ++i) {
    maxz[i] = max(maxz[b[i - 1]], i == m ? 0 : z[i]);
  }
  long long ans = (long long)n * m;
  for (int i = 0; i < n; ++i) {
    int maxt = b[m + 1 + i];
    if (maxt == i + 1) maxt = b[maxt - 1];
    ans -= maxz[maxt];
  }
  printf("%lld\n", ans);
}
