#include <bits/stdc++.h>
using namespace std;
long long cnta[300005], c;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '4' || s[i] == '8' || s[i] == '0') c++;
    if (i != s.size() - 1) {
      int x = ((s[i] - '0') * 10) + (s[i + 1] - '0');
      if (x % 4 == 0) c += (i + 1);
    }
  }
  cout << c;
  return 0;
}
