#include <bits/stdc++.h>
using namespace std;
long long cnt[15], aux[15];
char sir[100010];
int main() {
  scanf("%s", sir + 1);
  int n = strlen(sir + 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = sir[i] - '0' + 1; j < 11; j++) {
      int nxt = (10 + j * (j - 1) / 2 + sir[i] - '0') % 11;
      aux[nxt] += cnt[j];
    }
    for (int i = 0; i < 11; i++) {
      cnt[i] = aux[i];
      aux[i] = 0;
    }
    if (sir[i] != '0') cnt[sir[i] - '0']++;
    for (int i = 0; i < 11; i++) ans += cnt[i];
  }
  printf("%I64d", ans);
  return 0;
}
