#include <bits/stdc++.h>
using namespace std;
const int N = (int)(2e5) + 322;
const long long inf = (long long)(1e18) + 123;
const int mod = (int)(1e9) + 7;
const double EPS = 1e-9;
const int magic = 100;
string s;
int n;
int nxt[N];
int pref[N];
long long answer;
int c[N * (magic + 2)];
inline long long getSum(const long long &x) { return (x - 1) * x / 2ll; }
inline long long calcForK(const long long &k) {
  long long curres = 0;
  c[n]++;
  for (int i = 1; i <= n; ++i) {
    long long curpref = pref[i] * k - i + n;
    curres += c[curpref];
    c[curpref]++;
  }
  for (int i = 1; i <= n; ++i) {
    c[pref[i] * k - i + n]--;
  }
  c[n] = 0;
  return curres;
}
inline int getDivInRange(const int &l, const int &r, const int &L,
                         const int &div) {
  int nl = max(l - L + 1, magic * div);
  int nr = (r - L + 1);
  if (nl > nr) return 0;
  return nr / div - (nl - 1) / div;
}
inline int calcForLarge(const int &L) {
  int curres = 0;
  int onepos = nxt[L];
  for (int i = 1; onepos <= n && L + i * magic - 1 <= n; ++i) {
    curres += getDivInRange(onepos, nxt[onepos + 1] - 1, L, i);
    onepos = nxt[onepos + 1];
  }
  return curres;
}
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  n = (int)(s.size());
  s = '@' + s;
  for (int i = 1; i <= n; ++i) {
    pref[i] = pref[i - 1] + (s[i] == '1');
  }
  nxt[n + 1] = n + 1;
  for (int i = n; i >= 1; --i) {
    nxt[i] = nxt[i + 1];
    if (s[i] == '1') {
      nxt[i] = i;
    }
  }
  for (int k = 1; k < magic; ++k) {
    answer += calcForK(k);
  }
  for (int i = 1; i <= n; ++i) {
    answer += calcForLarge(i);
  }
  cout << answer;
  return 0;
}
