#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  string s;
  cin >> s;
  int64_t ans = (s[0] % 4 == 0);
  for (int64_t i = 1; i < s.length(); i++) {
    int64_t cur = s[i] - '0';
    ans += (cur % 4 == 0);
    cur += 10 * (s[i - 1] - '0');
    ans += (cur % 4 == 0) ? i : 0;
  }
  cout << ans << "\n";
}
