#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
int n;
const int N = 200100;
const int sq = 450;
int pre[N];
int nxt[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  int n = (int)s.size();
  for (int i = 1; i <= n; i++) {
    pre[i] = pre[i - 1] + (s[i - 1] == '1');
  }
  long long res = 0;
  for (int k = 1; k < sq; k++) {
    vector<long long> cur;
    for (int i = 0; i <= n; i++) {
      cur.push_back(pre[i] * k - i);
    }
    sort(cur.begin(), cur.end());
    for (int i = 0; i < (int)cur.size();) {
      long long t = 0;
      long long c = cur[i];
      while (i < (int)cur.size() and cur[i] == c) {
        t++;
        i++;
      }
      res = res + 1ll * (t * (t - 1) / 2);
    }
  }
  nxt[n + 1] = n + 1;
  for (int i = n; i >= 1; i--) {
    if (s[i - 1] == '1')
      nxt[i] = i;
    else
      nxt[i] = nxt[i + 1];
  }
  for (int i = 1; i <= n; i++) {
    int r = nxt[i];
    long long inside = 1;
    while (inside * sq <= N) {
      if (r > n) break;
      int L = r, R = nxt[r + 1] - 1;
      long long Kl = (L - i + 1);
      long long Kr = (R - i + 1);
      Kl = max(Kl, inside * sq);
      if (Kl % inside != 0) Kl += (inside - (Kl % inside));
      if (Kr % inside != 0) Kr -= (Kr % inside);
      if (Kl <= Kr) {
        res = res + (1ll * (Kr - Kl) / inside) + 1;
      }
      r = nxt[r + 1];
      inside++;
    }
  }
  cout << res << "\n";
}
