#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long x = 0, y = 0;
  string s;
  cin >> s;
  for (int i = s.length() - 1; i >= 0; i--) {
    if ((s[i] - '0') % 4 == 0) x += 1;
    if (i > 0 && ((s[i - 1] - '0') * 10 + (s[i] - '0')) % 4 == 0) y += i;
  }
  cout << x + y << flush;
  return 0;
}
