import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
    string s = scan;
    int n = s.length.to!int;

    long[] xs, ys;
        // x はそこより前での奇数桁目（添字は偶数）の1の個数
        // y はそこより前での偶数桁目（添字は奇数）の1の個数
    long xcnt, ycnt;
    foreach(i; 0 .. n){
        if(i % 2 == 0 && s[i] == '1') xcnt += 1;
        if(i % 2 == 1 && s[i] == '1') ycnt += 1;
        xs ~= xcnt, ys ~= ycnt;
    }
    log("xs:", xs, "ys:", ys);

    long allcnt = xcnt + ycnt;
    log("allcnt:", allcnt);

    int[] zps;
        // zps[j] は j番目（0始まり）の0の座標（0始まり）
    foreach(i; 0 .. n){
        if(s[i] == '0') zps ~= i;
    }
    log("zps:", zps);

    long ans;
    foreach(k; 0 .. allcnt){
        ans += k / 2 + 1;
        log("k:", k, "ans:", ans);
    }
    foreach_reverse(j, zp; zps){
        log("j:", j, "zp:", zp);
        ans += (zp - j + 1) / 2;
        log("ans:", ans);
        if((zp - j) % 2 == 0){ // この0は現時点で奇数桁目
            if(zp % 2 == 0){ // この0は最終結果でも奇数桁目
                ans += xcnt - xs[zp];
                log("odd, odd", "ans:", ans);
            }
            else{
                ans += ycnt - ys[zp];
                log("odd, even", "ans:", ans);
            }
        }
        else{ // この0は現時点で偶数桁目
            if(zp % 2 == 0){ // この0は最終結果では奇数桁目
                ans += ycnt - ys[zp];
                log("even, odd", "ans:", ans);
            }
            else{
                ans += xcnt - xs[zp];
                log("even, even", "ans:", ans);
            }
        }
    }

    ans.writeln;




}

