please see attachment file
Lets say that is first type of shares and is second type of shares.
So you can buy total shares:
In order to earn $540 you must set following equation:
So you have systems of equations:
We solve first equation for :
We susbtitute in second equation:
We susbtitute in first equation:
So solution is that you have to buy 100 shares of $32 and 300 shares of 23$.