#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long int n = s.size(), i, c = 0, x, y;
  for (i = 0; i < n; i++) {
    if (i == n - 1) {
      x = s[i] - 48;
      if (x % 4 == 0) c++;
    } else {
      x = s[i] - 48;
      y = s[i + 1] - 48;
      if (x % 4 == 0) c++;
      if ((x * 10 + y) % 4 == 0) c = c + i + 1;
    }
  }
  cout << c;
}
