#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long a = 0, b = 1, c = 0;
  for (long long i = 0; i < s.size(); ++i)
    if (((long long)s[i] - 48) % 4 == 0) ++a;
  for (long long i = 0; i < s.size() - 1; ++i)
    if (stoi(s.substr(i, 2)) % 4 == 0) a += i + 1;
  cout << a;
  return 0;
}
