Canonical Systems on the Line with Rational Spectral Densities: Explicit Formulas