#include <bits/stdc++.h>
using namespace std;
void read() { freopen("input.txt", "r", stdin); }
bool check(string s) {
  long long ans = s[0] - '0';
  ans = ans * 10ll + (s[1] - '0');
  if (ans % 4 == 0) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long ans = 0;
  for (long long i = 0; i < (long long)s.size(); i++) {
    if ((s[i] - '0') % 4 == 0) ans++;
  }
  string temp = "";
  for (long long i = 0; i < (long long)s.size() - 1; i++) {
    temp += s.substr(i, 2);
    if (check(temp)) {
      ans += i + 1;
    }
    temp = "";
  }
  cout << ans << endl;
  return 0;
}
