#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const int B = 300;
char s[MAXN];
int sm[MAXN], c[MAXN * B];
inline long long f(long long a, long long b, long long x, long long k) {
  return max(0ll, (b + k - x) / k - (a - 1 + k - x) / k);
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  vector<int> ind;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    sm[i] = sm[i - 1] + s[i] - '0';
    if (s[i] == '1') ind.push_back(i);
  }
  ind.push_back(n + 1);
  for (int k = 1; k < B; k++) {
    for (int i = 0; i <= n; i++) ans += (long long)c[k * sm[i] - i + n]++;
    for (int i = 0; i <= n; i++) c[k * sm[i] - i + n]--;
  }
  for (int k = 1; k <= n / B; k++)
    for (int i = 0, j = k - 1; i < n && j + 1 < (int)ind.size();
         i++, j += s[i] == '1')
      ans += f(max(B * k + i, ind[j]), ind[j + 1] - 1, i % k, k);
  printf("%I64d\n", ans);
  return 0;
}
