Exact solution for the diffusion in bistable potentials