#include #include //小数点出力用 //cout << fixed << setprecision(10) << ans; #include #include #include #include #include #include #include using ll = long long; using namespace std; #define modP 998244353 bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); } int clk4(int num) { return (num - 2) * (num % 2); } void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string S;cin >> S; ll ans = 0; int point = 0; int combo1 = 0; for (int i = S.size() - 1;i >= 0;i--) { if (S[i] == '0') { point++; combo1 = 0; } else { combo1++; if (combo1 == 2) { ans += (ll)point; combo1 = 0; } } } cout << ans; return 0; }