Imaginary-time path integrals from Klein-Gordon equation