(u, v, w, a, b)
return (w*u_1 + b*u_2)*(w*v_1 + b*v_2) + abs(a)*u_1*v_1
Returns a special dot product of the vectors `u = (u_{1}, u_{2})` and
    `v = (v_{1}, v_{2})` which is defined in order to reduce solution of
    the congruence equation `X^2 - aZ^2 \equiv 0 \ (mod \ b)`.
Returns a special dot product of the vectors `u = (u_{1}, u_{2})` and
    `v = (v_{1}, v_{2})` which is defined in order to reduce solution of
    the congruence equation `X^2 - aZ^2 \equiv 0 \ (mod \ b)`.
Returns a special dot product of the vectors u = ( u_ { 1 } u_ { 2 } ) and v = ( v_ { 1 } v_ { 2 } ) which is defined in order to reduce solution of the congruence equation X^2 - aZ^2 \ equiv 0 \ ( mod \ b ) .
def dot(u, v, w, a, b):
    """
    Returns a special dot product of the vectors `u = (u_{1}, u_{2})` and
    `v = (v_{1}, v_{2})` which is defined in order to reduce solution of
    the congruence equation `X^2 - aZ^2 \equiv 0 \ (mod \ b)`.
    """
    u_1, u_2 = u[:2]
    v_1, v_2 = v[:2]
    return (w*u_1 + b*u_2)*(w*v_1 + b*v_2) + abs(a)*u_1*v_1
def dot ( u , v , w , a , b ) : u_1 , u_2 = u [ : 2 ] v_1 , v_2 = v [ : 2 ] return ( w * u_1 + b * u_2 ) * ( w * v_1 + b * v_2 ) + abs ( a ) * u_1 * v_1