#include <bits/stdc++.h>
int m[11] = {-10000, 10, 0, 2, 5, 9, 3, 9, 5, 2, 0};
char s[100000 + 1];
int b[100000][11];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 11; ++j) {
      b[i][j] = 0;
    }
    int y = s[i] - '0';
    if (y > 0) {
      b[i][y] = 1;
    }
  }
  for (int i = 1; i < n; ++i) {
    int y = s[i] - '0';
    for (int j = y + 1; j < 11; ++j) {
      int j2 = (m[j] + y) % 11;
      b[i][j2] += b[i - 1][j];
    }
  }
  long long s = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 11; ++j) {
      s += b[i][j];
    }
  }
  printf("%lld\n", s);
  return 0;
}
