Step 1: Let the total journey time be \(T\) hours. Since Shyam walked all the way at 5 kmph, his distance covered is
\[
5T = 100 ⇒ T=20 \ \text{if he went alone.}
\]
But since Ram gives him a lift, total time reduces.
Step 2: Ram drives at 25 kmph. He drops Hari at some point, goes back to pick Shyam, then finally all travel forward. By symmetry and known result of "car and walker" problem, the common time equals
\[
T=\frac{\text{Total distance}}{\text{Harmonic mean of speeds}}.
\]
Step 3: A more direct reasoning: Suppose they meet such that all three reach together. Known result (standard CAT puzzle): The required time is \(\frac{100}{12.5}=8\) hours, since effectively average joint speed balances out between car and walker.
Thus the required time = \(\boxed{8}\) hours.