#include <bits/stdc++.h>
using namespace std;
char s[302000];
int main() {
  while (scanf("%s", s) != EOF) {
    long long ans = 0;
    int len = strlen(s);
    if (s[0] == '0' || s[0] == '4' || s[0] == '8') ans++;
    for (int i = 1; i < len; i++) {
      int num = s[i - 1] - '0';
      if (s[i] == '0' || s[i] == '4' || s[i] == '8') {
        ans++;
        if (num % 2 == 0) ans += i;
      }
      if (s[i] == '2' || s[i] == '6') {
        if (num % 2 == 1) ans += i;
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
