#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  string x;
  cin >> x;
  long long resu = 0;
  if (x[0] == '0' || x[0] == '4' || x[0] == '8') resu++;
  for (int i = 1; i < x.length(); i++) {
    int num = x[i - 1] - 48;
    if ((x[i] == '4' || x[i] == '8' || x[i] == '0') && num % 2 == 0)
      resu += i + 1;
    else if (x[i] == '4' || x[i] == '8' || x[i] == '0')
      resu++;
    if ((x[i] == '2' || x[i] == '6') && num % 2 != 0) resu += i;
  }
  cout << resu;
  return 0;
}
