#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
char s[N];
int dp[N][15];
int main() {
  ios::sync_with_stdio(false);
  cin >> (s + 1);
  int n = strlen(s + 1);
  long long ans = 0;
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j <= 10; j++) {
      dp[i][j] = 1;
      if (i == n) continue;
      int c = s[i + 1] - '0';
      if (c >= j) continue;
      dp[i][j] += dp[i + 1][(j * (j - 1) / 2 + c + 10) % 11];
    }
    if (s[i] - '0') ans += dp[i][s[i] - '0'];
  }
  cout << ans << endl;
  return 0;
}
