The goal is to find the right quantity to buy/sell in order to spend/raise an exact amount.
amount = a
quantity = q
outlay = o
fee = f
full_outlay = o + f = fo
price = p
multiplier = m
price * multiplier = pm
commission(q,p) = comm(q,p)