#include <bits/stdc++.h>
using namespace std;
const bool testing = false;
char c[100005];
long long _t1[2][11];
long long _t2[2][11];
void program() {
  long long res = 0;
  long long(*t1)[2][11] = &_t1;
  long long(*t2)[2][11] = &_t2;
  memset(*t1, 0, sizeof(_t1));
  scanf("%s", c);
  int i = 0;
  while (c[i]) {
    long long(&prev)[2][11] = *t1;
    long long(&cur)[2][11] = *t2;
    int val = c[i] - '0';
    memset(cur, 0, sizeof(_t1));
    if (val) {
      cur[0][val] = 1;
    }
    int positionin1 = val;
    int positionin0 = val;
    for (int j = 0; j < 11; j++) {
      if (j > val) {
        cur[1][positionin1] += prev[0][j];
      }
      if ((j + 10) % 11 > val) {
        cur[0][positionin0] += prev[1][j];
      }
      positionin1 += 0 + j;
      positionin1 %= 11;
      positionin0 += 10 + j;
      positionin0 %= 11;
    }
    for (int j = 0; j < 11; j++) {
      res += cur[0][j];
      res += cur[1][j];
    }
    long long(*tmp)[2][11] = t1;
    t1 = t2;
    t2 = tmp;
    i++;
  }
  cout << res << endl;
}
int main() {
  if (!testing) {
    program();
    return 0;
  }
  FILE* fin = NULL;
  fin = fopen("in.txt", "w+");
  fprintf(fin, "\n4021\n");
  fclose(fin);
  freopen("in.txt", "r", stdin);
  printf("test case(1) => expected : \n");
  printf("6");
  printf("test case(1) => found    : \n");
  program();
  fin = fopen("in.txt", "w+");
  fprintf(fin, "\n110\n");
  fclose(fin);
  freopen("in.txt", "r", stdin);
  printf("test case(2) => expected : \n");
  printf("3");
  printf("test case(2) => found    : \n");
  program();
  return 0;
}
