#include <bits/stdc++.h>
using namespace std;
int L[200000], R[200000], PS[200001];
vector<int> V;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ((void)0);
  ((void)0);
  ((void)0);
  int N, M;
  string s;
  long long ans = 0;
  cin >> s;
  N = s.size();
  for (M = 1; M * M <= N; M++)
    ;
  M--;
  if (M * M == N) {
    int sum = 0;
    s.push_back('0');
    N++;
    for (int i = N - 2; i >= 0; i--) {
      sum += s[i] - '0';
      if (sum && (N - i) % sum == 0) ans--;
    }
  }
  L[0] = s[0] == '0';
  R[N - 1] = s[N - 1] == '0';
  for (int i = 1; i < N; i++)
    L[i] = (s[i - 1] == '0' ? L[i - 1] : 0) + (s[i] == '0');
  for (int i = N - 2; i >= 0; i--)
    R[i] = (s[i + 1] == '0' ? R[i + 1] : 0) + (s[i] == '0');
  for (int i = 0; i < N; i++) PS[i + 1] = PS[i] + s[i] - '0';
  for (int m = 1; m * m <= N; m++) {
    int sum = 0, r = -1;
    for (int l = 0; l < N; l++) {
      while (sum < m && r + 1 < N) sum += s[++r] - '0';
      if (sum < m) break;
      if (r + R[r] - l + 1 > m * M)
        ans += (r + R[r] - l + 1) / m - max(r - l, m * M) / m;
      sum -= s[l] - '0';
    }
  }
  for (int m = 1; m * m <= N; m++) {
    int cnt = 1;
    V.clear();
    V.push_back(N);
    for (int i = 1; i <= N; i++) V.push_back(N - i + m * PS[i]);
    sort(V.begin(), V.end());
    for (int i = 1; i <= N; i++) {
      if (V[i - 1] == V[i])
        ans += cnt++;
      else
        cnt = 1;
    }
  }
  cout << ans << '\n';
  return 0;
}
