#include <bits/stdc++.h>
using namespace std;
mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
const int N = 3e5 + 10;
const long long MOD = 1e9 + 7;
const int rx[4] = {-1, 0, 1, 0};
const int ry[4] = {0, 1, 0, -1};
const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int hx[8] = {-2, -2, -1, 1, 2, 2, 1, -1};
const int hy[8] = {-1, 1, 2, 2, 1, -1, -2, -2};
const long double eps = 1e-7;
const double pi = acos(-1.0);
const int INF = 2e9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s, t;
  cin >> s >> t;
  string st = t + "#" + s;
  int n = s.size(), m = t.size();
  int p[m];
  p[0] = 0;
  vector<int> pref(m + 2, 0);
  for (int i = 1; i < m; i++) {
    int j = p[i - 1];
    while (j && t[i] != t[j]) j = p[j - 1];
    if (t[i] == t[j]) j++;
    p[i] = j;
    if (p[i]) pref[i - p[i] + 1]++;
  }
  for (int i = 1; i <= m + 1; i++) {
    pref[i] += pref[i - 1];
  }
  vector<int> z(n + m + 1, 0);
  int l = 0, r = 0;
  for (int i = 1; i < n + m + 1; i++) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n + m + 1 && st[z[i]] == st[i + z[i]]) {
      z[i]++;
    }
    z[m + 1] = 0;
    if (i + z[i] - 1 > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  long long ans = 0;
  for (int i = m; i < n + m; i++) {
    ans += m - pref[z[i + 1]];
  }
  cout << ans << '\n';
  return 0;
}
