def neg_pt(pt, curve):
    """Negate a point.

    Args:
        pt (tuple(int, int)): Point (x, y). Use (None, None) for point at infinity.
        curve (tuple(int, int, int)): (a, b, n) representing the
            Elliptic Curve y**2 = x**3 + a*x + b (mod n).

    Returns:
        tuple(int, int): Point -pt.
    """
    if pt == (None, None):
        return (None, None)
    x, y = pt
    _a, _b, n = curve
    return (x, n - y)