#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;

int n;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>s;

    n = s.size();
    s = " "+s;

    ll ans = 0;

    for(int i=1;i<=n;i++)
    {
        int st0 = 0;
        int st1 = 0;
        if(s[i]=='1')st0=1;
        else st1=1;
        for(int j=i+1;j<=n;j++)
        {
            if((j-i+1)%2==0)
            {
                if(s[j]=='1')st1++;
                else st0++;
            }
            else  
            {
                if(s[j]=='1')st0++;
                else st1++;
            }
            // cout<<i<<' '<<j<<' '<<min(st0,st1)<<'\n';
            ans += min(st0,st1);
        }
    }

    cout<<ans<<'\n';
    
}
// 64 位输出请用 printf("%lld")

简单模拟题