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