#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
char s[N];
vector<int> p1;
int sum[N * 2];
unordered_map<int, int> num;
int main() {
  int n;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int m = min(n, 2000);
  for (int i = 1; i <= n; i++) {
    if (s[i] == '1') p1.push_back(i);
    sum[i] = sum[i - 1] + (s[i] == '1');
  }
  p1.push_back(n + 1);
  int sz = p1.size();
  long long ans = 0;
  for (int i = 1; i <= m && i < sz; i++) {
    int l = 1, r = i;
    for (; l <= n; l++) {
      ans += (p1[r] - l) / i - (p1[r - 1] - l) / i;
      if (s[l] == '1') r++;
      if (r >= sz) break;
    }
  }
  if (m >= sz) return 0 * printf("%lld\n", ans);
  for (int k = 1; k <= n / m; k++) {
    num.clear();
    int r = m, l = 0, pl = 1, v;
    num[0] = 1;
    for (int i = p1[m]; i <= n; i++) {
      r += s[i] == '1';
      while (sum[i] - sum[pl] > m) {
        l += s[pl] == '1';
        v = pl - l * k;
        num[v]++;
        pl++;
      }
      v = i - r * k;
      ans += num[v];
    }
  }
  printf("%lld\n", ans);
  return 0;
}
