t=eval(input())

n=len(t)

pos=[]

sum=0

for i in range(n):

  if t[i]=="1":

    sum+=1

  else:

    pos.append(sum)

x=(sum+1)//2*((sum+2)//2)

sz=len(pos)

cnt=0

res=[]

for i in range(sz):

  if ((pos[i]&1)^(cnt&1)):

    sum+=1

    cnt+=1

    x+=(sum+1)//2

  else:

    res.append(i)

res=res[::-1]

odd=0

even=0

for i in range(len(res)):

  sum+=1

  if i&1:

    odd = sz - res[i] - even

    x+=(sum+1)//2-odd

  else:

    even=sz-res[i]-odd

    x+=(sum+1)//2-even

print(x)
T=eval(input())

n=len(T)

i=r=a=0

for c in T:

  k=i-r

  if c=='0':

    r+=~k&1

  else:

    a+=i//2-k//2+(~k&1)*(n-i)

  i+=1

print(a)

t = eval(input())
n = len(t)
pos = []
sum = 0
for i in range(n):
    if t[i] == "1":
        sum += 1
    else:
        pos.append(sum)
x = (sum + 1) // 2 * ((sum + 2) // 2)
sz = len(pos)
cnt = 0
res = []
for i in range(sz):
    if (pos[i] & 1) ^ (cnt & 1):
        sum += 1
        cnt += 1
        x += (sum + 1) // 2
    else:
        res.append(i)
res = res[::-1]
odd = 0
even = 0
for i in range(len(res)):
    sum += 1
    if i & 1:
        odd = sz - res[i] - even
        x += (sum + 1) // 2 - odd
    else:
        even = sz - res[i] - odd
        x += (sum + 1) // 2 - even
print(x)

T = eval(input())
n = len(T)
i = r = a = 0
for c in T:
    k = i - r
    if c == "0":
        r += ~k & 1
    else:
        a += i // 2 - k // 2 + (~k & 1) * (n - i)
    i += 1
print(a)

-t = eval(input()) -n = len(t) -pos = [] -sum = 0 -for i in range(n): -    if t[i] == "1": -        sum += 1 +T = eval(input()) +n = len(T) +i = r = a = 0 +for c in T: +    k = i - r +    if c == "0": +        r += ~k & 1 -        pos.append(sum) -x = (sum + 1) // 2 * ((sum + 2) // 2) -sz = len(pos) -cnt = 0 -res = [] -for i in range(sz): -    if (pos[i] & 1) ^ (cnt & 1): -        sum += 1 -        cnt += 1 -        x += (sum + 1) // 2 -    else: -        res.append(i) -res = res[::-1] -odd = 0 -even = 0 -for i in range(len(res)): -    sum += 1 -    if i & 1: -        odd = sz - res[i] - even -        x += (sum + 1) // 2 - odd -    else: -        even = sz - res[i] - odd -        x += (sum + 1) // 2 - even -print(x) +        a += i // 2 - k // 2 + (~k & 1) * (n - i) +    i += 1 +print(a)