Genos needs your help. He was asked to solve the following programming problem by Saitama:

The length of some string s is denoted |s|. The Hamming distance between two strings s and t of equal length is defined as $\sum_{i = 1}^{|s|}|s_{i} - t_{i}|$, where s_{i} is the i-th character of s and t_{i} is the i-th character of t. For example, the Hamming distance between string "0011" and string "0110" is |0 - 0| + |0 - 1| + |1 - 1| + |1 - 0| = 0 + 1 + 0 + 1 = 2.

Given two binary strings a and b, find the sum of the Hamming distances between a and all contiguous substrings of b of length |a|.


-----Input-----

The first line of the input contains binary string a (1 ≤ |a| ≤ 200 000).

The second line of the input contains binary string b (|a| ≤ |b| ≤ 200 000).

Both strings are guaranteed to consist of characters '0' and '1' only.


-----Output-----

Print a single integer — the sum of Hamming distances between a and all contiguous substrings of b of length |a|.


-----Examples-----
Input
01
00111

Output
3

Input
0011
0110

Output
2



-----Note-----

For the first sample case, there are four contiguous substrings of b of length |a|: "00", "01", "11", and "11". The distance between "01" and "00" is |0 - 0| + |1 - 0| = 1. The distance between "01" and "01" is |0 - 0| + |1 - 1| = 0. The distance between "01" and "11" is |0 - 1| + |1 - 1| = 1. Last distance counts twice, as there are two occurrences of string "11". The sum of these edit distances is 1 + 0 + 1 + 1 = 3.

The second sample case is described in the statement.

Difficulty: interview

Starter code:

Solutions:
#!/usr/bin/env python3

a = input()
b = input()

sumi = 0

for i in range(len(b) - len(a) + 1):
    if b[i] == '1':
        sumi += 1

lowest = 0
highest = len(b) - len(a) + 1

total = 0
for i in range(len(a)):
    if a[i] == '0':
        total += sumi
    else:
        total += highest - lowest - sumi
    if b[lowest] == '1':
        sumi -= 1
    if highest < len(b) and b[highest] == '1':
        sumi += 1
    lowest += 1
    highest += 1
print(total)


a=input()
b=input()

A=len(a)
B=len(b)
d=B-A+1

l=[-1]*A

count=0

for i in range (d):
    if b[i]=='1':
        count += 1

l[0]=count
c=0

for i in range (d, B):
    if b[i] == '1':
        count += 1
    if b[c] == '1':
        count -= 1
    c += 1
    l[c]=count

net=0

for i in range (A):
    if a[i] == '0':
        net += l[i]
    else:
        net += d - l[i]

print(net)


import math


#n, s = tuple(map(int, input().split()))
#floors = [0 for i in range(s + 1)]

#for i in range(n):
#    floor, time = tuple(map(int, input().split()))
#    floors[floor] = max(floors[floor], time)

#res = s
#for i in range(s + 1):
#    res = max(res, floors[i] + i)

#print(res)

a = input()
b = input()
shift = [0]
for i in range(len(b) - len(a) + 1):
    shift[0] += int(b[i])
for i in range(len(a) - 1):
    shift.append(shift[i] - int(b[i]) + int(b[len(b) - len(a) + i + 1]))

res = 0
for i in range(len(a)):
    if a[i] == '0':
        res += shift[i]
    else:
        res += len(b) - len(a) + 1 - shift[i]
print(res)



a = list(map(int, input()))
b = list(map(int, input()))

ps = [0] * (len(b) + 1)
for i in range(len(b)):
    ps[i + 1] = ps[i] + b[i]

ans = 0
for i in range(len(a)):
    left = i
    right = len(b) - len(a) + i + 1
    sub = ps[right] - ps[left]
    if a[i] == 1:
        sub = right - left - sub
    ans += sub
print(ans)

a = input().rstrip()
b = input().rstrip()
n, m = len(a), len(b)
q = [0] * (m + 1)
for i in range(1, m + 1):
    q[i] = q[i - 1] + int(b[i - 1])
ans = 0
w = m - n + 1
for i in range(n):
    if a[i] == '0':
        ans += q[w + i] - q[i]
    else:
        ans += w - (q[w + i] - q[i])
print(ans)

import math
import itertools

a = [int(x) for x in input().rstrip()]
b = [int(x) for x in input().rstrip()]
n = len(a)
m = len(b)
prefix_b = [0] + list(itertools.accumulate(b))
res = 0
for i in range(n):
    ones = prefix_b[-n+i] - prefix_b[i]
    res += m-n+1 - ones if a[i] else ones
print(res)
    

    


a, b = '0'+input(),'0'+input()
m, n = len(a), len(b)
c, s = [0]*(n+1), 0 
if m <= n:    
    for i in range(1,n):
        c[i] = int(b[i]) + c[i-1]
    for i in range(1,m):
        if a[i] == '0':
            s += c[i+n-m]-c[i-1]
        else:
            s += n-m+1 - (c[i+n-m]-c[i-1])
print(s)


#!/usr/bin/env python3

a, b = input(), input()
alen, blen = len(a), len(b)  # blen >= alen

diff = blen-alen
count = b[:diff+1].count('0')
result = 0
for i in range(0, alen):
    #print('at i=%d, count=%d' % (i, count))
    result += diff+1-count if a[i] == '0' else count
    #print('compared at', i, diff+i+1)
    if i == alen-1: break
    count -= 1 if b[i] == '0' else 0
    count += 1 if b[diff+1+i] == '0' else 0
print(result)


import sys

a = sys.stdin.readline().rstrip()
b = sys.stdin.readline().rstrip()

la, lb = len(a), len(b)
sum, cur = 0, 0

for i in range(lb - la + 1):
    cur += int(b[i])

for i in range(la):
    if a[i] == '0':
        sum += cur
    else:
        sum += (lb - la + 1) - cur

    if i != la - 1:
        if b[i] == '1':
            cur -= 1
        if b[lb-la+i+1] == '1':
            cur += 1

print(sum)



__author__ = 'MoonBall'

import sys
# sys.stdin = open('data/B.in', 'r')
T = 1

def process():
    a = input()
    b = input()
    zero = [0] * 210000

    for i, c in enumerate(a):
        zero[i + 1] = zero[i] + (1 if c == '0' else 0)

    ans = 0
    for i, c in enumerate(b):
        s = max(1, len(a) - (len(b) - i) + 1)
        e = min(i + 1, len(a))
        z = (1 if c == '0' else 0)
        o = 1 - z

        ans += z * (e - s + 1 - (zero[e] - zero[s - 1]))
        ans += o * (zero[e] - zero[s - 1])

    print(ans)








for _ in range(T):
    process()


a = input()
b = input()
num_n = [0]
num_one = [0]
for elem in a:
    if elem == '1':
        num_one.append(num_one[-1] + 1)
        num_n.append(num_n[-1])
    else:
        num_one.append(num_one[-1])
        num_n.append(num_n[-1] + 1)  
res = 0
la = len(a)
lb = len(b)
for i in range(lb):
    left = max(0, i - lb + la)
    right = min(la - 1, i)
    if b[i] == '1':
        res += num_n[right + 1] - num_n[left]
    else:
        res += num_one[right + 1] - num_one[left]
print(res)

a = list(input())
b = list(input())
sum = 0
for i in range(len(a)):
    sum += int(a[i])
    a[i] = sum
a.insert(0, 0)
sum = 0
for i in range(len(b)):
    l = max(0, len(a) - 1 - (len(b) - i))
    r = min(len(a) - 2, i)
    col1 = a[r + 1] - a[l]
    col2 = r - l + 1 - col1
    if b[i] == '0':
        sum += col1
    else:
        sum += col2
print(sum)


read = lambda: list(map(int, input()))
a, b = read(), read()
n, m = len(a), len(b)
cnt1 = [0] * (n + 1)
cnt0 = [0] * (n + 1)
if a[0]: cnt1[0] = 1
else: cnt0[0] = 1
for i in range(1, n):
    cnt1[i] = cnt1[i - 1]
    cnt0[i] = cnt0[i - 1]
    if a[i]: cnt1[i] += 1
    else: cnt0[i] += 1
Sum = 0
for i in range(m):
    L = max(0, n + i - m)
    R = min(n - 1, i)
    if b[i]: cur = cnt0[R] - cnt0[L - 1]
    else: cur = cnt1[R] - cnt1[L - 1]
    Sum += cur
print(Sum)


a = input()
b = input()
al = len(a)
bl = len(b)
num = bl - al + 1
num2 = 0
for i in range(num):
    if a[0] != b[i]:
        num2 += 1
num3 = num2
for i in range(1,al):
    if a[i-1] != a[i]:
        if a[i] == b[i-1]:
            num2 -= 1
        num2 = num - num2 - 1
    else:
        if a[i] != b[i-1]:
            num2 -= 1
    if a[i] != b[i+num-1]:
        num2 += 1
    num3 += num2
print(num3)


a=input()
b=input()
a1=[0]
curr=0
for i in b:
    if i=='1':
        curr+=1
    a1.append(curr)
a2=[0]
curr=0
for i in b:
    if i=='0':
        curr+=1
    a2.append(curr)
ans=0
for i in range(len(a)):
    if a[i]=='0':
        t=a1[len(b)-len(a)+i+1]-a1[i]
        if t>=0:
            ans+=t
        else:
            break
for i in range(len(a)):
    if a[i]=='1':
        t=a2[len(b)-len(a)+i+1]-a2[i]
        if t>=0:
            ans+=t
        else:
            break
print(ans)


a=input()
b=input()
t=0
ans=0
p=len(b)-len(a)+1

for i in range(len(b)-len(a)+1):
    t+=int(b[i])

for j in range(len(a)):
    v=int(a[j])
    if v==1:
        ans=ans+p-t
    else:
        ans=ans+t
    if j==len(a)-1:
        break
    t=t+int(b[p+j])
    t=t-int(b[j])

print(ans)


s = [bool(int(i)) for i in input()]
n = [bool(int(i)) for i in input()]
k = 0
a = 0
b = 0
n1 = [0]
for i in n:
	a+=i
	n1.append(a)
for i in range(len(s)):
	if not s[i]:
		k+=(n1[len(n)-len(s)+i+1]-n1[i])
	else:
		k+=(len(n)-len(s)+i+1 - n1[len(n)-len(s)+i+1]-(i - n1[i]))
print(k)
	


def main():
    a = input()
    b = input()

    total_comparable = len(b) - len(a) + 1
    if total_comparable < 1:
        print(0)
        return

    cumulitive_one_b = [0] * len(b)

    for i in range(len(b)):
        if i != 0:
            cumulitive_one_b[i] += cumulitive_one_b[i - 1]

        if b[i] == '1':
            cumulitive_one_b[i] += 1

    hamming_distance = 0

    for i in range(len(a)):
        start = i
        end = i + total_comparable - 1
        if start == 0:
            total_comparable_one = cumulitive_one_b[end]
        else:
            total_comparable_one = cumulitive_one_b[end] - cumulitive_one_b[start - 1]

        if a[i] == '0':
            hamming_distance += total_comparable_one
        else:
            hamming_distance += total_comparable - total_comparable_one

    print(hamming_distance)


def __starting_point():
    main()

__starting_point()

a = input()
b = input()
ans = 0
pref = [0 for i in range(len(b) + 1)]
for i in range(len(b)):
    pref[i + 1] = pref[i] + int(b[i])
for i in range(len(a)):
    ans += abs(int(a[i]) * (len(b) - len(a) + 1) - pref[len(b) - len(a) + i + 1] + pref[i])
print(ans)

a = input()
b = input()
l = len(b)
p0 = [0] * (l + 1)
s0 = [0] * (l + 1)
p1 = [0] * (l + 1)
s1 = [0] * (l + 1)

for i in range(l):
    if b[i] == '0':
        p1[i + 1] = p1[i] + 1
        p0[i + 1] = p0[i]
    else: 
        p0[i + 1] = p0[i] + 1
        p1[i + 1] = p1[i]
    
for i in range(l - 1, -1, -1):
    if b[i] == '0':
        s1[i] = s1[i + 1] + 1
        s0[i] = s0[i + 1]
    else:
        s0[i] = s0[i + 1] + 1
        s1[i] = s1[i + 1]
    
l1 = len(a)
res = 0
for i in range(l1):
    if a[i] == '0':
        res += p0[l] - p0[i] - s0[l - l1 + i + 1]
    if a[i] == '1':
        res += p1[l] - p1[i] - s1[l - l1 + i + 1]   
print(res)

def solve():
    S = input()
    T = input()

    lens = len(S)
    lent = len(T)

    a0 = [0] * lens
    a1 = [0] * lens
    for i in range(lens):
        if i > 0:
            a0[i] = a0[i - 1]
            a1[i] = a1[i - 1]
        if S[i] == '0':
            a1[i] += 1
        else:
            a0[i] += 1

    ans = 0
    for i in range(lens):
        if T[i] == '0':
            ans += a0[i]
        else:
            ans += a1[i]

    for i in range(lens, lent):
        if T[i] == '0':
            ans += a0[-1]
        else:
            ans += a1[-1]

    for i in range(lent - lens + 1, lent):
        d = lent - i
        if T[i] == '0':
            ans -= a0[-d - 1]
        else:
            ans -= a1[-d - 1]

    print(ans)


def __starting_point():
    solve()

__starting_point()

p = input()
s = input()
n = len(s)
ans = 0
dl = len(s) - len(p)
m = ([(0, 0), (0, 1)] if s[0] == '1' else [(0, 0), (1, 0)])
for i in range(1, n):
     if s[i] == '0':
         m.append((m[-1][0] + 1, m[-1][1]))
     else:
         m.append((m[-1][0], m[-1][1] + 1))

for i in range(len(p)):
     if p[i] == '0':
          ans += (m[dl + i + 1][1] - m[i][1])
     else:
          ans += (m[dl + i + 1][0] - m[i][0])
print(ans)


import sys
if False:
	inp = open('B.txt', 'r')
else:
	inp = sys.stdin
count = [0]

a = inp.readline().strip()
b = inp.readline().strip()
for i in range(len(b)):
	count.append(count[i] + int(b[i]))
lengthA = len(a)
lengthB = len(b)
ans = 0
for i in range(lengthA):
	if a[i] == '0':
		ans += count[lengthB + i - lengthA + 1] - count[i]
	else:
		ans += lengthB - lengthA + 1 - count[lengthB + i - lengthA + 1] + count[i]
print(ans)
		







a = input()
b = input()
a_ones = [0 for i in range(len(a)+2)]
a_zeros = [0 for i in range(len(a)+2)]
counter1 = 0
counter0 = 0
total = 0
ones = 0
zeros = 0
la = len(a)
k = len(b)-la+1
for i in range(la):
    if a[i] == '1':
        counter1 += 1
    else:
        counter0 += 1
    a_ones[i] = counter1
    a_zeros[i] = counter0
la -= 1
if len(a)*2 <= len(b):
    for i in range(len(b)):
        if i < la:
            ones = a_ones[i]
            zeros = a_zeros[i]
            if b[i] == '0':
                total += ones
            else:
                total += zeros
        elif (la <= i)and(i <= len(b)-la-1):
            ones = a_ones[la]
            zeros = a_zeros[la]
            if b[i] == '0':
                
                total += ones
            else:
                total += zeros
        else:
            ones = a_ones[la]-a_ones[-len(b)+la+i]
            zeros = a_zeros[la]-a_zeros[-len(b)+la+i]
            if b[i] == '0':
                total += ones
            else:
                total += zeros
    print(total)
else:
    for i in range(len(b)):
        if i < len(b)-la-1:
            ones = a_ones[i]
            zeros = a_zeros[i]
            if b[i] == '0':
                total += ones
            else:
                total += zeros
        elif i > la:
            ones = a_ones[la]-a_ones[-len(b)+la+i]
            zeros = a_zeros[la]-a_zeros[-len(b)+la+i]
            if b[i] == '0':
                total += ones
            else:
                total += zeros
        else:
            ones = a_ones[i+len(b)-la-k]-a_ones[i-k]
            zeros = a_zeros[i+len(b)-la-k]-a_zeros[i-k]
            if b[i] == '0':
                total += ones
            else:
                total += zeros
    print(total)
    
    


a,b,c,d,e=input(),input(),[0],0,0
for i in range(len(b)):d+=int(b[i]);c.append(d)
for i in range(len(a)):
    nOO=c[len(b)-(len(a)-i)+1]-c[i]
    nOZ=len(b)-len(a)+1-nOO
    if a[i]=='0':e+=nOO
    else:e+=nOZ
print(e)