#include <bits/stdc++.h>
using namespace std;
int n, f[100005][15];
char s[100005];
int nxt(int x, int c) { return ((x * (x - 1) >> 1) + c + 10) % 11; }
long long ans = 0;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = s[i] - '0' + 1; j <= 10; j++)
      f[i][nxt(j, s[i] - '0')] += f[i - 1][j];
    if (s[i] > '0') ++f[i][s[i] - '0'];
    for (int j = 0; j <= 10; j++) ans += f[i][j];
  }
  printf("%lld\n", ans);
}
