B is the correct selection.
You can try the answers, or you can solve for x.
.. (3x -1) +(x +4) = 31 . . . . the sum of segment lengths is 31
.. 4x +3 = 31 . . . . . . . . . . .simplified
.. 4x = 28 . . . . . . . . . . . . .subtract 3
.. x = 7 . . . . . . . . . . . . . . . divide by the coefficient of x