\delta\int Ldt=\delta\int\left(\sum_{i}p_i\dot{q}_i-H\right)dt=0