4. The sequence $\left\{a_{n}\right\}$ satisfies $a_{1}=\frac{1}{4}, a_{2}=\frac{1}{5}$, and $a_{1} a_{2}+a_{2} a_{3}+\cdots+a_{n} a_{n+1}=n a_{1} a_{n+1}$ for any positive integer $n$, then the value of $\frac{1}{a_{1}}+\frac{1}{a_{2}}+\cdots+\frac{1}{a_{97}}$ is
4. 5044 .

From $a_{1} a_{2}+a_{2} a_{3}=2 a_{1} a_{3}$ and $a_{1}=\frac{1}{4}, a_{2}=\frac{1}{5}$, we get $a_{3}=\frac{1}{6}$. From $a_{1} a_{2}+a_{2} a_{3}+a_{3} a_{4}=3 a_{1} a_{4}$, we can get $a_{4}=\frac{1}{7}$. Furthermore, we can prove by mathematical induction that $a_{n}=\frac{1}{n+3}$. Therefore, $\frac{1}{a_{1}}+\frac{1}{a_{2}}+\cdots+\frac{1}{a_{97}}=$ $4+5+\cdots+100=5044$.