#include<fstream>
#include<sstream>
#include<cstring>
using namespace std;
int main()
{
	ifstream f1("STRD4.INP");
	ofstream f2("STRD4.OUT");
	string s;
	f1>>s;
	f1.close();
	int n=s.length();
	int i,j;
	int u=0;
	for(i=0;i<n;i++)
	{
		string t = "";
		t=s[i];
		stringstream str2num;
		str2num << t;
		long long x;
		str2num>>x;
		if (x % 4 == 0) u++;
		if (i > 0)
		{
		t= s[i-1] + s[i];
		stringstream str2num;
		str2num << t;
		long long x;
		str2num>>x;
		if (x % 4 == 0) u += i;
		u--;
	    }
	}
		f2<<u;
	return 0;
}

