import std.stdio;
import std.string;

void main ()
{
	string s;
	while ((s = readln.strip) != "")
	{
		long res = 0;
		foreach (pos; 1..s.length + 1)
		{
			res += !(s[pos - 1] & 3);
			if (pos > 1 && !((s[pos - 2] * 2 + s[pos - 1]) & 3))
			{
				res += pos - 1;
			}
		}
		writeln (res);
	}
}
