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