#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, D = 150, D2 = N / D + 10;
int nxt[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.length();
  s = ' ' + s;
  nxt[n + 1] = n + 1;
  for (int i = n; i >= 1; --i) {
    nxt[i] = nxt[i + 1];
    if (s[i] == '1') {
      nxt[i] = i;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    int j = i - 1, cnt = 0;
    while (cnt <= D2) {
      j = nxt[j + 1];
      if (j == n + 1) {
        break;
      }
      ++cnt;
      int tmp = nxt[j + 1];
      int l = j - i + 1, r = tmp - i;
      l = max(l, D * cnt + 1);
      if (l <= r) {
        ans += r / cnt - (l - 1) / cnt;
      }
    }
  }
  for (int k = 0; k < D; ++k) {
    map<long long, int> cnt;
    long long cur = 0;
    cnt[cur]++;
    for (int i = 1; i <= n; ++i) {
      if (s[i] == '0') {
        ++cur;
      } else {
        cur -= k;
      }
      ans += cnt[cur];
      ++cnt[cur];
    }
  }
  cout << ans << endl;
}
