#include <bits/stdc++.h>
using namespace std;
int inline read() {
  int num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
const int maxn = 100010, mod = 998244353;
int n, f[maxn][11];
long long ans;
char str[maxn];
int F(int x, int y) { return (x * (x - 1) / 2 + y + 10) % 11; }
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (int i = n; i >= 1; i--) {
    int a = str[i] - '0';
    for (int j = 0; j < 11; j++)
      if (a < j)
        f[i][j] = f[i + 1][F(j, a)] + 1;
      else
        f[i][j] = 0;
    if (a) ans += f[i + 1][a] + 1;
  }
  printf("%lld", ans);
  return 0;
}
