First calculate the moment due to the 40 N force. As one gear turns, the other gear must also turn. Where the gears meet, the teeth must both move in the same direction. In the diagram ...