Index of an extremal of a Lagrange problem with periodic boundary conditions