Hi I am have a real life problem, but somehow cannot get the 'b' side of the equation and think I am making the wrong assumption for the "c's"

I have attached the model of my problem, and I know the following:

The a's: Hin, Hout

The b's: (b+Vin), (b+Vout), where I put in negative for values under the b datum.

The c's: I know the total length, Ctot, between Cin and Cout, and made the assumptions Ctot=Cin+Cout and Ctot^2=Cin^2+Cout^2

And knowing the Pythagoras theorem, and rearranging to get a quadratic equation I can find b. But I think I am making the wrong assumption for the formula for the Ctot, with respect to Cin and Cout. I need help on this part of the assumption for my formula.

This is what I got:

Combining two Pythagoras equations, and making them equal 0

([tex]Hin^{2}[/tex]+[tex](B+Vin)^{2}[/tex]-[tex]Cin^{2}[/tex])+([tex]Hout^{2}[/tex]+[tex](B+Vout)^{2}[/tex]-[tex]Cout^{2}[/tex])=0

Expanding I get the below, and think I made a mistake for the last Ctot part of the expression, to get Ctot in terms of Cin and Cout.

2*[tex]b^{2}[/tex]+b*2*(Vin+Vout)+[tex]Vin^{2}[/tex]+[tex]Vout^{2}[/tex]+[tex]Hin^{2}[/tex]+[tex]Hout^{2}[/tex]-[tex]Ctot^{2}[/tex]

When solving using the quatdratic equation, I get a b value. But, when I take my b and substitute for each triangle, and sum to verify the Ctot. I don't get the same Ctot that is known.

Please help, as I need another person's set of eyes to possible see what I am doing wrong.

Regards and Thank-you,

Miguel