Help Needed in Building a Logic to distribute any given amount "X" for "N" number of Stocks with different Prices.

Dear Forum,

I have a situation where I need to develop a scientific and mathematical approach which involves a lot of business sense before I put my money in Stocks.

While Investing in Stocks, we come across a situation where we need to diversify and put our money in specific stocks....Now this step is already been done...

Now, I have already selected the number of Stocks and also the Names of the Stocks...Each Stock has a different price and each is expected to rise or fall differently..

I would like to know how much money I need to put in each Stock so as to earn more profits with that combination.

Ex:-
Lets say If I have $ 10000 and I have selected three Stocks to be bought with this amount..

STOCK-NAME--PRICE------PROFIT
Stock I---------$ 32--------$ 37
Stock II--------$ 55--------$ 62
Stock III-------$ 77--------$ 81

I want to get a Logic which gives me which utilises the Investin amount and buys Stocks in such a way that can yield the maximum Profit...

This is a concept and the No of Stocks can increase or decrease as well as the Investing amount, the logic should be strong enough to be able to expand ...