Step 1: Why momentum is conserved.
The rails are frictionless and horizontal, so no outside horizontal force acts on the man plus trolley. That means their total momentum stays zero, just like it started.
Step 2: Write the momentum balance.
Let the man's ground velocity be $v_m$ and the trolley's be $v_t$. Man mass $80\ \text{kg}$, trolley mass $320\ \text{kg}$. \[ 80\,v_m + 320\,v_t = 0 \;\Rightarrow\; v_m = -4\,v_t \] The minus sign just shows they move opposite ways.
Step 3: Use the walking speed.
The man walks at $1\ \text{m s}^{-1}$ relative to the trolley, so \[ v_m - v_t = 1 \] Substitute $v_m = -4v_t$: \[ -4v_t - v_t = 1 \;\Rightarrow\; -5v_t = 1 \;\Rightarrow\; v_t = -0.2\ \text{m s}^{-1} \]
Step 4: Man's speed over the ground.
\[ v_m = -4v_t = -4(-0.2) = 0.8\ \text{m s}^{-1} \] So the man actually moves at $0.8\ \text{m s}^{-1}$ across the ground.
Step 5: Displacement in 4 seconds.
\[ x = v_m \times t = 0.8 \times 4 = 3.2\ \text{m} \]
Step 6: Conclusion.
Relative to the ground the man moves 3.2 m. \[ \boxed{3.2\ \text{m}} \]