#include <bits/stdc++.h>
using namespace std;
long long n, ans;
string s;
long long a[100010], f[100010][12], sum[12];
long long read() {
  long long r = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') r = (r << 1) + (r << 3) + c - '0', c = getchar();
  return r * f;
}
void put(long long x) {
  if (x < 0) {
    putchar('-');
    x = ~x + 1;
  }
  if (x > 9) put(x / 10);
  putchar(x % 10 + '0');
}
long long get(long long ss, long long r) {
  return (10 + sum[(ss + 10) % 11] + r) % 11;
}
signed main() {
  cin >> s, n = s.size();
  for (long long i = 1; i <= 11; i++) sum[i] = (sum[i - 1] + i) % 11;
  for (long long i = 0; i < n; i++) a[i + 1] = s[i] - '0';
  for (long long i = 1; i <= n; i++) {
    for (long long j = a[i] + 1; j < 11; j++) f[i][get(j, a[i])] += f[i - 1][j];
    if (a[i]) f[i][a[i]]++;
    for (long long j = 0; j < 11; j++) ans += f[i][j];
  }
  put(ans), puts("");
  return 0;
}
