#include <bits/stdc++.h>
using namespace std;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
const int N = 5e6 + 1;
char c[N + 5];
string a,b;
int z[N + 1];
long long ans;
int main(){
// freopen("input.txt","r",stdin);
freopen("ultron.in","r",stdin);
freopen("ultron.out","w",stdout);
scanf("%s",c);
a = c;
scanf("%s",c);
b = c;
for(auto &i : a)i = tolower(i);
for(auto &i : b)i = tolower(i);
string s = a + '#' + b;
int l = 0,r = 0;
for(int i = 1;i < s.size();i++)
if(r < i){
l = r = i;
while(r < s.size() && s[r] == s[r - l])r++;
z[i] = r - l;
r--;
}
else{
int x = i + z[i - l];
if(x > r){
l = i;
while(r && s[r] == s[r - l])r++;
z[i] = r - l;
r--;
}
else z[i] = z[i - l];
}
for(int j = a.size() + 1;j < s.size();j++){
int bst = z[j];
int i = j - a.size() - 1;
if(bst != -1)ans+=(bst + 1LL)*bst/2 + bst*1LL*(b.size() - i - bst);
}
printf("%lld\n",ans);
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cm10MTk5Mzcgcm5nKHN0ZDo6Y2hyb25vOjpzeXN0ZW1fY2xvY2s6Om5vdygpLnRpbWVfc2luY2VfZXBvY2goKS5jb3VudCgpKTsKY29uc3QgaW50IE4gPSA1ZTYgKyAxOwpjaGFyIGNbTiArIDVdOwpzdHJpbmcgYSxiOwppbnQgeltOICsgMV07CmxvbmcgbG9uZyBhbnM7CmludCBtYWluKCl7CgkvLyBmcmVvcGVuKCJpbnB1dC50eHQiLCJyIixzdGRpbik7CglmcmVvcGVuKCJ1bHRyb24uaW4iLCJyIixzdGRpbik7CglmcmVvcGVuKCJ1bHRyb24ub3V0IiwidyIsc3Rkb3V0KTsKCXNjYW5mKCIlcyIsYyk7CglhID0gYzsKCXNjYW5mKCIlcyIsYyk7CgliID0gYzsKCWZvcihhdXRvICZpIDogYSlpID0gdG9sb3dlcihpKTsKCWZvcihhdXRvICZpIDogYilp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