#include <bits/stdc++.h>
using namespace std;
const int inf = 1e18;
const int mod = 1e9 + 7;
int con = 2500;
int n, nxt[2 * 100009 + 2], one[2 * 100009 + 2];
long long sum[2 * 100009 + 2], ses = 0;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  s = "#" + s;
  int nw = n + 1;
  for (int i = n; i >= 1; i--) {
    nxt[i] = nw;
    if (s[i] == '1') nw = i;
  }
  for (int i = 1; i <= n; i++) {
    int rgt = i;
    if (s[i] != '1') rgt = nxt[i];
    for (int j = 1; j <= con && rgt <= n; j++) {
      int tmp = nxt[rgt] - 1;
      ses += (((tmp - i + 1) / j) - ((rgt - i)) / j);
      rgt = nxt[rgt];
    }
  }
  for (int k = 1; k * (con + 1) <= n; k++) {
    for (int i = 1; i <= n; i++) {
      sum[i] = sum[i - 1] + 1;
      if (s[i] == '1') sum[i] -= k;
    }
    for (int i = 1; i <= n; i++) {
      one[i] = one[i - 1];
      if (s[i] == '1') one[i]++;
    }
    map<long long, int> cnt;
    int pre = 0;
    for (int i = 1; i <= n; i++) {
      while (one[i] - one[pre] > con) {
        cnt[sum[pre]]++;
        pre++;
      }
      ses += cnt[sum[i]];
    }
  }
  cout << ses << endl;
  return 0;
}
