I want to participate in the 2024 election prediction market.
There are 2 candidates: Kamala and Trump.
There are 2 markets: Election winner and Popular vote winner.
I want to be able to set the prices of Yes and No shares for each outcome and the joint probabilities of each pair of outcomes (i.e. Kamala winning the election but losing the popular vote, which is impossible and I want to set it to 0). They should be setable in the code, don't use input(). 
Write a Python program to find guaranteed opportunities AND the most profitable strategy given my custom odds.
Keep in mind, I can only buy shares since I don't have any right now.
Also, a common pitfall is giving a (0, 0, 0, 0) sulution with 0 profit, avoid that.
Also, sometimes the strategy could be just buying one share, when the probability of it is higher than the price, don't forget that, it's not always pairs.
Try to keep it simple, don't use tools that are unnecessary. Also, make comments less verbose or don't use them when they're not needed.

I got this code, but it only outputs the best strategy. I would like it to also output guaranteed opportunities, when we cover all outcomes and it's still profitable:

import numpy as np
from scipy.optimize import linprog

# --- Configuration ---
# Prices for Election Winner Market
election_yes_price = 0.4   # Price for Kamala winning the election
election_no_price = 0.6    # Price for Trump winning the election

# Prices for Popular Vote Winner Market
popular_yes_price = 0.63    # Price for Kamala winning the popular vote
popular_no_price = 0.37     # Price for Trump winning the popular vote

# Joint Probabilities
p1 = 0.4  # Kamala wins election AND Kamala wins popular vote
p2 = 0.0  # Kamala wins election AND Trump wins popular vote (set to 0 if impossible)
p3 = 0.4  # Trump wins election AND Kamala wins popular vote
p4 = 0.2  # Trump wins election AND Trump wins popular vote

# Ensure probabilities sum to 1
assert abs(p1 + p2 + p3 + p4 - 1.0) < 1e-6, "Joint probabilities must sum to 1."

# Budget for investment
budget = 1.0

# --- Calculations ---
# Expected payouts for each share
E1 = p1 + p2  # Election Yes (Kamala wins election)
E2 = p3 + p4  # Election No (Trump wins election)
E3 = p1 + p3  # Popular Yes (Kamala wins popular vote)
E4 = p2 + p4  # Popular No (Trump wins popular vote)

# Profit per share
A1 = E1 - election_yes_price
A2 = E2 - election_no_price
A3 = E3 - popular_yes_price
A4 = E4 - popular_no_price

# Objective: Maximize A1*x1 + A2*x2 + A3*x3 + A4*x4
# To use linprog which minimizes, we use negative coefficients
c = [-A1, -A2, -A3, -A4]

# Constraints:
# P1*x1 + P2*x2 + P3*x3 + P4*x4 <= budget
A_ub = [p1 + p2, p3 + p4, p1 + p3, p2 + p4]
b_ub = [budget]

# Bounds for x1, x2, x3, x4 (cannot buy negative shares)
bounds = [(0, None), (0, None), (0, None), (0, None)]

# Solve the linear programming problem
result = linprog(c, A_ub=[A_ub], b_ub=b_ub, bounds=bounds, method='highs')

if result.success:
    max_profit = -(result.fun)
    if max_profit > 1e-6:
        x1, x2, x3, x4 = result.x
        print("Arbitrage Opportunity Found!")
        print(f"Invested Amount: {np.dot([election_yes_price, election_no_price, popular_yes_price, popular_no_price], result.x):.4f}")
        print(f"Expected Profit: {max_profit:.4f}")
        print("Strategy:")
        if x1 > 1e-6:
            print(f"  Buy {x1:.4f} shares of Election Yes (Kamala wins election)")
        if x2 > 1e-6:
            print(f"  Buy {x2:.4f} shares of Election No (Trump wins election)")
        if x3 > 1e-6:
            print(f"  Buy {x3:.4f} shares of Popular Yes (Kamala wins popular vote)")
        if x4 > 1e-6:
            print(f"  Buy {x4:.4f} shares of Popular No (Trump wins popular vote)")
    else:
        print("No arbitrage opportunity found.")
else:
    print("Optimization failed. Please check the input values.")