If the current position is odd add it to currOdd , otherwise to currEven
if pos & 1 : NEW_LINE INDENT currOdd += d NEW_LINE DEDENT else : NEW_LINE INDENT currEven += d NEW_LINE DEDENT ans += count ( pos + 1 , currEven , currOdd , currF , num ) NEW_LINE dp [ pos ] [ even ] [ odd ] [ tight ] = ans NEW_LINE return dp [ pos ] [ even ] [ odd ] [ tight ] NEW_LINE