#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m;
int z[N], lcp[N], cnt[N];
string s, t;
int main() {
  cin >> s >> t;
  m = t.size();
  string tmp = t + '$' + s;
  n = tmp.size();
  int l = 0, r = 0;
  for (int i = 0; i < n; i++) {
    if (i > r) {
      l = r = i;
      while (r < n and 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 < n and tmp[r - l] == tmp[r]) r++;
        z[i] = r - l;
        r--;
      }
    }
  }
  n = s.size();
  for (int i = m + 2; i < m + n + 1; i++) {
    cnt[z[i]]++;
  }
  for (int i = m; i > 0; i--) {
    cnt[i - 1] += cnt[i];
  }
  l = 0, r = 1;
  while (r != m) {
    if (t[l] == t[r]) {
      lcp[r++] = ++l;
    } else {
      if (l == 0)
        lcp[r++] = 0;
      else
        l = lcp[l - 1];
    }
  }
  long long ans = 1ll * n * m;
  for (int i = 0; i < m; i++) {
    if (lcp[i]) ans -= cnt[i + 1 - lcp[i]];
  }
  cout << ans << endl;
}
