def METHOD_NAME(X1, Y1, X2, Y2):
    if X1 == 0 and Y1 == 0:
        return (X2, Y2)
    if X1 == X2 and Y1 == Y2:
        return double(X1, Y1)
    if X1 == X2 and (Y1 + Y2) % p == 0:
        return (0, 0)
    u = Y2 - Y1
    uu = pow(u, 2, p)
    v = X2 - X1
    vv = pow(v, 2, p)
    vvv = v * vv % p
    R = vv * X1 % p
    A = uu - vvv - 2 * R
    X3 = v * A % p
    Y3 = (u * (R - A) - vvv * Y1) % p
    Z3 = vvv
    Z3inv = pow(Z3, p - 2, p)
    x3 = X3 * Z3inv % p
    y3 = Y3 * Z3inv % p
    return (x3, y3)