#include <bits/stdc++.h>
using namespace std;
int get() {
  char ch;
  while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-')
    ;
  if (ch == '-') {
    int s = 0;
    while (ch = getchar(), ch >= '0' && ch <= '9') s = s * 10 + ch - '0';
    return -s;
  }
  int s = ch - '0';
  while (ch = getchar(), ch >= '0' && ch <= '9') s = s * 10 + ch - '0';
  return s;
}
const int N = 1e5 + 5;
char s[N];
int n;
int f[N][15];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int c = s[i] - '0';
    for (int x = 0; x <= 10; x++)
      if (f[i - 1][x]) {
        if (x > c) {
          int y = (x + 10) % 11;
          f[i][(y * (y + 1) / 2 + 9 + c + 1) % 11] += f[i - 1][x];
        }
      }
    if (c) f[i][c]++;
    for (int x = 0; x <= 10; x++) ans = ans + f[i][x];
    int stop = 1;
  }
  cout << ans << endl;
  return 0;
}
