#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,tune=native")
template <typename T>
void print(T&& x) {
  cout << x << "\n";
}
template <typename T, typename... S>
void print(T&& x, S&&... y) {
  cout << x << ' ';
  print(y...);
}
const long long Mod = 1000000007, Mod2 = 998244353;
const long long MOD = Mod2;
const long long maxn = 100005;
long long n, val[11] = {49, 10, 0, 2, 5, 9, 3, 9, 5, 2, 0}, dp[maxn][12], res;
string str;
void orzck() {
  cin >> str;
  n = ((long long)str.size());
  for (long long i = (0); i < ((long long)(11)); i++) dp[n - 1][i] = 0;
  for (long long i = (n - 2); i >= ((long long)(0)); i--)
    for (long long j = (0); j < ((long long)(11)); j++) {
      if (j <= str[i + 1] - '0')
        dp[i][j] = 0;
      else
        dp[i][j] = dp[i + 1][(val[j] + str[i + 1] - '0') % 11] + 1;
    }
  for (long long i = (0); i < ((long long)(n)); i++)
    if (str[i] != '0') res += 1 + dp[i][str[i] - '0'], 826;
  print(res);
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cout << fixed << setprecision(15);
  long long t;
  t = 1;
  while (t--) orzck();
  return 0;
}
