# Looking for an optimal random equation using statistics

I have a mathematical problem that I try to solve, but I'm not sure how to do it. It is quite complex, but I will try to describe the exact problem. The last line in this description of the problem is to what the question of the problem is reduced.

Link to the image that shows the statistics in excel:
Image of the statistics.

Description of the mathematical problem:
1. in average We want to invest 100 dollars in Total through all levels. This may mean that sometimes we invest 150.$$in total and sometimes only$$50. But on average this will be around \$ 100 over time (Big Numbers Act)

1. A person will place bets on a table. EACH bet has a sequence of 1-4 bets (which are levels 1-4). The trick is that sometimes the sequence will only be level 1, sometimes it will be 1 and 2, sometimes 1,2,3 and sometimes all 4. We never know beforehand! As we can see, 1372 of the Total 3430 bets will stop at level 1. 1029 of the bets will reach level 2 and then bet on both level 1 and level 2. This is how the logic goes down to level 4.

2. Now the problem comes. What is the OPTIMAL way (I emphasize OPTIMAL) to invest through the 4 levels? I have done 2 theoretical examples where I take as an example for level 2: (33.33$$* 1029 bets * 0.23% = 64.02$$ profit)

Example 1) Medium bet 33.33$$at the level 1,2,3 that gives: 182.91$$ in Total Profit.
Example 2) Medium bet 33.33$$at level 1. 36.33$$ in level 2. 30.33$$in level 3 that gives: 185.07$$ in total benefit

This shows that example 2 is a more OPTIMA way to invest.
Remember that we want in our equation about average Invest \$ 100 through level 1-4.

The problem is reduced to this question:
We need to invest a sum in RANDOM in Each level using some kind of equation using the statistics to reach the OPTIMAL Total result of earnings over time. (Law of Large Numbers). My question is what will this equation look like? The RANDOM function / equation and how / what amount of dollars will we invest in each level? (I think the green fields are the important information, but feel free to use the other information as well)

Thank you!