#include <bits/stdc++.h>
char s[200005];
int b[200005], c[50000005];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  std::vector<int> ind;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    b[i] = b[i - 1] + s[i] - '0';
    if (s[i] == '1') ind.push_back(i);
  }
  ind.push_back(n + 1);
  for (int k = 1; k <= 249; k++) {
    for (int i = 0; i <= n; i++) ans += (long long)c[k * b[i] - i + n]++;
    for (int i = 0; i <= n; i++) c[k * b[i] - i + n]--;
  }
  for (int k = 1; k <= n / 250; k++) {
    int j = k - 1;
    for (int i = 0; i <= n - 1 && j + 1 < ind.size(); i++) {
      ans += (long long)std::max(
          0, (ind[j + 1] - 1 + k - i % k) / k -
                 (std::max(250 * k + i, ind[j]) - 1 + k - i % k) / k);
      j += s[i + 1] == '1';
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
