Lets assume that the red ball is more dense than the white fluid and less dense than the blue fluid. The fluids are of very low viscosity and the machine can be of any height. The flaps open when pushed from the bottom and after the ball goes through then they close hermetically(some magnets perhaps).
My understanding is as follows:
The ball needs a finite velocity to open the flaps. Since H1, H2, can be of any height that is not a problem.
The ball needs a finite velocity to jump off the water high enough. That is not a problem since H3 can be of any height.
The ball needs a finite velocity to get into the water. That is not a problem since H1+H2+H3 can be of any height.
If it worked it would be a perpetuum mobile. Please help me find out why it won't work.