#include <bits/stdc++.h>
using namespace std;
int n;
char s[100010];
long long dp[11], ep[11];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) s[i] -= '0';
  if (s[1] > 0) dp[s[1]] = 1;
  long long ans = 0;
  ans = accumulate(dp, dp + 11, ans);
  for (int i = 2; i <= n; i++) {
    memset(ep, 0, sizeof ep);
    if (s[i] > 0) ep[s[i]]++;
    for (int j = s[i] + 1; j <= 10; j++) {
      int cur = 9;
      cur += j * (j + 1) * 6;
      cur -= j - 1 - s[i];
      cur %= 11;
      ep[cur] += dp[j];
    }
    swap(dp, ep);
    ans = accumulate(dp, dp + 11, ans);
  }
  cout << ans << endl;
}
