#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  long long x = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if ((s[i] - '0') % 4 == 0) x++;
    if (i > 0) {
      int s2 = 0;
      s2 = (s[i - 1] - '0') * 10 + s[i] - '0';
      if (s2 % 4 == 0) x += i;
    }
  }
  cout << x;
  return 0;
}
