def evalZ(x,y):
    """value of Z based on values of X and Y

        Input:
        x,y:    values of x and y

        Output:
        res:    Z

    """
    if (x >= 2):
        return x%2
    else:
        return (x+y)%2