#include <bits/stdc++.h>
using namespace std;
long long dp[100005][15], ans;
string x;
int main() {
  cin >> x;
  for (int i = x.size() - 1; i >= 0; i--) {
    for (int j = 0; j <= 10; j++) {
      dp[i][j] = 1;
      if (i < x.size() - 1 && j > x[i + 1] - '0') {
        dp[i][j] += dp[i + 1][(j * (j - 1) / 2 + x[i + 1] - '0' + 10) % 11];
      }
    }
    if (x[i] != '0') ans += dp[i][x[i] - '0'];
  }
  cout << ans << endl;
}
