#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 2e5 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ = 555;
const long double EPS = 1e-7;
int cnt[N * (N / SQ)];
string s;
int sum[N];
int CO[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  vector<int> ones;
  ones.push_back(s.size());
  ll ans = 0;
  for (int i = s.size() - 1; i >= 0; --i) {
    if (s[i] == '1') ones.push_back(i);
    for (int j = 0; j < min(SQ, (int)ones.size() - 1); j++) {
      int curOnes = j + 1;
      int curSz = ones[ones.size() - 1 - j] - i + 1;
      int nxtSz = ones[ones.size() - 1 - (j + 1)] - i;
      ans += nxtSz / curOnes;
      ans -= (curSz - 1) / curOnes;
    }
  }
  if (SQ >= s.size()) {
    cout << ans << '\n';
    return 0;
  }
  int n = s.size();
  for (int i = 0; i < n; i++) {
    CO[i + 1] = CO[i] + (s[i] == '1');
  }
  for (int coff = 1; coff <= n / SQ; coff++) {
    for (int j = 0, i = 0; j < n; j++) {
      sum[j + 1] = sum[j] + (s[j] == '1') * coff - 1;
      while (CO[j + 1] - CO[i] > SQ) cnt[sum[i++] + N]++;
      ans += cnt[sum[j + 1] + N];
    }
    for (int j = 0; j <= n; j++) {
      cnt[sum[j] + N] = 0;
    }
  }
  cout << ans << '\n';
  return 0;
}
