#include <bits/stdc++.h>
using namespace std;
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getchar());
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
  return sum * fg;
}
namespace HASH {
const int MOD = 998244353, B = 233;
const int MAX_LEN = (int)1e5;
int pw[MAX_LEN + 5];
inline void init() {
  pw[0] = 1;
  for (int i = 1; i <= MAX_LEN; ++i) pw[i] = (long long)pw[i - 1] * B % MOD;
}
struct hash_table {
  int N;
  int *pre;
  inline void build(char *s, int _N) {
    delete[] pre;
    pre = new int[(N = _N) + 1];
    pre[0] = 0;
    for (int i = 1; i <= N; ++i)
      pre[i] = (pre[i - 1] + (long long)s[i] * pw[i] % MOD) % MOD;
  }
  inline int query(int l, int r) {
    return l > r
               ? -1
               : (long long)pw[MAX_LEN - l] * (pre[r] - pre[l - 1] + MOD) % MOD;
  }
};
}  // namespace HASH
using HASH::hash_table;
const int MAXN = (int)1e5;
int n, m;
char S[MAXN + 5], T[MAXN + 5];
inline void input() {
  scanf("%s%s", S + 1, T + 1);
  n = strlen(S + 1);
  m = strlen(T + 1);
}
inline void solve() {
  static hash_table s, t;
  s.build(S, n);
  t.build(T, m);
  static int cnt[MAXN + 5];
  for (int i = 2; i <= n; ++i) {
    int l = 0, r = min(n - i + 1, m);
    while (l < r) {
      int mid = (l + r + 1) / 2;
      if (s.query(i, i + mid - 1) == t.query(1, mid))
        l = mid;
      else
        r = mid - 1;
    }
    ++cnt[l];
  }
  for (int i = m - 1; i >= 1; --i) cnt[i] += cnt[i + 1];
  static int fail[MAXN + 5];
  fail[1] = 0;
  for (int i = 2, j = 0; i <= m; ++i) {
    while (j && T[j + 1] != T[i]) j = fail[j];
    if (T[j + 1] == T[i]) ++j;
    fail[i] = j;
  }
  long long ans = (long long)n * m;
  for (int i = 2; i <= m; ++i)
    if (fail[i]) ans -= cnt[i - fail[i]];
  printf("%lld\n", ans);
}
int main() {
  HASH::init();
  input();
  solve();
  return 0;
}
