#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  long long n = s.length();
  long long dp[n + 1];
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    if (s[i - 1] == '4' || s[i - 1] == '8' || s[i - 1] == '0') dp[i]++;
    if (i > 1) {
      if ((s[i - 1] == '4' || s[i - 1] == '8' || s[i - 1] == '0') &&
          (s[i - 2] == '2' || s[i - 2] == '4' || s[i - 2] == '0' ||
           s[i - 2] == '6' || s[i - 2] == '8'))
        dp[i] += (i - 1);
      if ((s[i - 1] == '2' || s[i - 1] == '6') &&
          (s[i - 2] == '1' || s[i - 2] == '3' || s[i - 2] == '5' ||
           s[i - 2] == '7' || s[i - 2] == '9'))
        dp[i] += (i - 1);
    }
  }
  cout << dp[n];
}
