#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int f[N][11];
long long ans;
string s;
int nxt(int x, int c) { return (x * (x - 1) / 2 + c + 10) % 11; }
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  int n = s.length();
  for (register int i = (1); i <= (n); ++i) {
    for (register int j = (s[i - 1] - '0' + 1); j <= (10); ++j)
      f[i][nxt(j, s[i - 1] - '0')] += f[i - 1][j];
    if (s[i - 1] != '0') f[i][s[i - 1] - '0']++;
    for (register int j = (0); j <= (10); ++j) ans += f[i][j];
  }
  cout << ans << '\n';
  return 0;
}
