First of all: I cannot see the entire problem.
Second: This is posted in the wrong category. You have posted it in the French category, while clearly you have a Mathematical problem to deal with.
I would suggest changing the category so that people like me would be able to help you. I wish you all the best!