If we look at the Lagrange's equation
$\frac{d}{dt}(\frac{\partial L}{\partial \dot{q_i}})- \frac{\partial L}{\partial q_i}=0$
It is clear that Lagrangian is invariant under a Transformation $L \rightarrow L + \frac{dF (q_i,t)}{dt}$
because $\frac{\partial \dot{F}(q_i,t)}{\partial \dot{q_i}} = \frac{\partial F}{\partial q} $
But when we look at the action,
$A=\int L{dt}$,
A transformation of the kind $L \rightarrow L + \frac{dF(q_i, \dot{q_i}, t)}{dt}$ would leave the extrema of action invariant and hence the equations of motion should also be invariant(according to the principle of least action) because the total time derivative of $F$ would contribute just a constant.
So under what kind of transformation are equations of motion invariant? $L \rightarrow L + \frac{dF (q_i,t)}{dt}$ or $L \rightarrow L + \frac{dF(q_i, \dot{q_i}, t)}{dt}$
I mean what kind of function should F be? Is it allowed to have explicit dependence on $\dot{q_i}$?