The modified trapezoidal rule for line integrals