#include<bits/stdc++.h>
using namespace std;
int main ()
{
	string n;
	ifstream f1("STRD4.INP");
	ofstream f2("STRD4.OUT");
	getline(f1,n);
	int dem=0,i;
	for(i=n.length()-1;i>=0;i--)
		{
			if((int(n[i])+10*int(n[i-1]))%4==0)
			dem=dem+i+1;
			if(int(n[i])%4==0) dem++;	
		}
	f2<<dem;
}
