Thanks for your answer, K^2!
Now that I'm looking at my post again I realize I didn't formulate it properly. Speaking about time derivative of function F, which, when added to Langrangian, does not change the equations of motion, I should have written
F(q,t)
instead of
F(q,\dot{q})
In...