#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int len, lenS, lenT;
int z[N], lcp[N], cnt[N];
string s, t, tmp;
void ZFunction() {
  int l = 0, r = 0;
  for (int i = 0; i < len; i++) {
    if (i > r) {
      l = r = i;
      while (r < len && tmp[r - l] == tmp[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 < len && tmp[r - l] == tmp[r]) {
          r++;
        }
        z[i] = r - l;
        r--;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> s >> t;
  lenS = s.size();
  lenT = t.size();
  tmp = t + '#' + s;
  len = tmp.size();
  ZFunction();
  for (int i = lenT + 2; i < lenT + lenS + 1; i++) {
    cnt[z[i]]++;
  }
  for (int i = lenT; i > 0; i--) {
    cnt[i - 1] += cnt[i];
  }
  int l = 0, r = 1;
  while (r != lenT) {
    if (t[l] == t[r]) {
      lcp[r++] = ++l;
    } else {
      if (l == 0) {
        lcp[r++] = 0;
      } else {
        l = lcp[l - 1];
      }
    }
  }
  long long res = 1LL * lenS * lenT;
  for (int i = 0; i < lenT; i++) {
    if (lcp[i]) {
      res -= cnt[i + 1 - lcp[i]];
    }
  }
  cout << res << '\n';
  return 0;
}
