It is formula number 2 if the pipe can change angle at both ends. If the pipe is properly fixed at one end, such as embedded in a thick concrete wall, it is a different version of the formula.
Since you have two forces, perform the calculation once for each force and add the deflections.