#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
long long dp[maxn][11];
long long ans = 0;
char s[maxn];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j <= 10; j++) {
      dp[i][j] = 1;
      int t = s[i + 1] - '0';
      if (i < n && j > t) {
        dp[i][j] += dp[i + 1][(j * (j - 1) / 2 + t + 10) % 11];
      }
    }
    if (s[i] != '0') ans += dp[i][s[i] - '0'];
  }
  printf("%lld\n", ans);
}
