#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-5;
const long double PI = acos(-1);
const int INF = (int)1e9;
const long long INFF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MXN = (int)2e5 + 7;
char s1[MXN], s2[MXN], s3[MXN];
int fail[MXN];
int l1, l2, l3;
vector<int> st;
int Z[MXN];
void build() {
  int l = strlen(s2 + 1);
  fail[1] = 0;
  int pos = 0;
  for (int i = 2; i <= l; ++i) {
    while (pos != 0 && s2[i] != s2[pos + 1]) pos = fail[pos];
    if (s2[i] == s2[pos + 1]) pos++;
    fail[i] = pos;
    if (fail[i]) st.push_back(i - fail[i]);
  }
  sort(begin(st), end(st));
  l = l3;
  Z[1] = 0;
  for (int b = 1, i = 2; i <= l; ++i) {
    Z[i] = max(min(Z[i - b + 1], Z[b] + b - i), 0);
    while (i + Z[i] <= l && s3[i + Z[i]] == s3[Z[i] + 1]) Z[i]++;
    if (i + Z[i] > b + Z[b]) b = i;
  }
  return;
}
int main(void) {
  scanf("%s %s", s1 + 1, s2 + 1);
  l1 = strlen(s1 + 1);
  l2 = strlen(s2 + 1);
  l3 = l1 + l2;
  for (int i = 1; i < l2 + 1; ++i) s3[i] = s2[i];
  for (int i = 1; i < l1 + 1; ++i) s3[i + l2] = s1[i];
  build();
  long long ans = l1 * 1ll * l2;
  for (int i = 2; i < l1 + 1; ++i) {
    int len = Z[i + l2];
    auto it = upper_bound(begin(st), end(st), len);
    ans -= it - st.begin();
  }
  printf("%lld\n", ans);
  return 0;
}
