#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void ckmin(T &a, U b) {
  if (a > b) a = b;
}
template <class T, class U>
void ckmax(T &a, U b) {
  if (a < b) a = b;
}
int N;
bitset<200013> bs;
int nxt[200013];
long long ans;
long long c(int r, int m, int mod) { return (r + (mod - m)) / mod; }
int cc(int lt, int rt, int m, int mod) {
  if (lt > rt) return 0;
  return c(rt, m, mod) - c(lt - 1, m, mod);
}
int32_t main() {
  cout << fixed << setprecision(12);
  cerr << fixed << setprecision(4);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string temps;
  cin >> temps;
  N = ((int)(temps).size());
  for (auto i = (1); i < (N + 1); i++) {
    bs[i] = (temps[i - 1] == '1');
  }
  nxt[N + 1] = N + 1;
  for (auto i = (N + 1) - 1; i >= (0); i--) {
    nxt[i] = (bs[i + 1] ? i + 1 : nxt[i + 1]);
  }
  int co = N / (213 - 1) + 5;
  for (auto i = (1); i < (N + 1); i++) {
    long long num = bs[i], lt = i, rt = nxt[i] - 1;
    while (true) {
      if (num) {
        ans += cc(max(num * 213 + i - 1, lt), rt, (i - 1) % num, num);
      }
      rt++;
      lt = rt;
      if (rt > N) break;
      rt = nxt[rt] - 1;
      num++;
      if (num > co) break;
    }
  }
  for (auto i = (1); i < (213); i++) {
    vector<long long> vec;
    vec.push_back(0);
    for (auto j = (1); j < (N + 1); j++) {
      vec.push_back(vec.back() + 1 - (bs[j] ? i : 0));
    }
    sort((vec).begin(), (vec).end());
    long long dp = 0;
    for (auto j = (0); j < (((int)(vec).size())); j++) {
      ans += dp;
      if (j != ((int)(vec).size()) - 1 && vec[j] == vec[j + 1]) {
        dp++;
      } else {
        dp = 0;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
