#include <bits/stdc++.h>
using namespace std;
using ui32 = unsigned int;
using i64 = long long;
using f64 = long double;
using ui64 = unsigned long long;
void read(int& x) { scanf("%d", &x); }
void read(int n, vector<int>& a) {
  for (int i = 0; i < n; i++) read(a[i]);
}
void read(int n, int* a) {
  for (int i = 0; i < n; i++) read(a[i]);
}
void write(int x) { printf("%d\n", x); }
void print(int x) { printf("%d ", x); }
void write(int n, vector<int> a) {
  for (int i = 0; i < n; i++) printf("%d\n", a[i]);
}
void print(int n, int* a) {
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
}
void print(string s) { printf("%s\n", s.c_str()); }
i64 z[3 * 100007], lcp[3 * 100007], cnt[3 * 100007];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s, t;
  cin >> s >> t;
  string concate = t + '#' + s;
  i64 n = (i64)(concate.size()), m = (i64)(t.size());
  i64 l = 0;
  i64 r = 0;
  for (i64 i = 0; i < n; i++) {
    if (i > r) {
      l = i;
      r = i;
      while (r < n && concate[r - l] == concate[r]) {
        r++;
      }
      z[i] = r - l;
      r--;
    } else {
      i64 k = i - l;
      if (z[k] < r - i + 1)
        z[i] = z[k];
      else {
        l = i;
        while (r < n && concate[r - l] == concate[r]) {
          r++;
        }
        z[i] = r - l;
        r--;
      }
    }
  }
  n = (i64)(s.size());
  for (i64 i = m + 2; i < n + m + 1; i++) {
    cnt[z[i]]++;
  }
  for (i64 i = m; i > 0; i--) {
    cnt[i - 1] += cnt[i];
  }
  l = 0;
  r = 1;
  while (r != m) {
    if (t[l] == t[r]) {
      l++;
      lcp[r] = l;
      r++;
    } else {
      if (l == 0) {
        lcp[r] = 0;
        r++;
      } else {
        l = lcp[l - 1];
      }
    }
  }
  i64 ans = n * m;
  for (i64 i = 0; i < m; i++) {
    if (lcp[i] != 0) {
      ans -= cnt[i + 1 - lcp[i]];
    }
  }
  cout << ans << endl;
}
