Input (grade 13): In 1813, following Napoleon's defeat in Russia, Frederick William turned against France and signed an alliance with Russia at Kalisz, although he had to flee Berlin, still under French occupation.
Output (grade 8): After Napoleon's defeat in Russia (1813) Frederick William turned against France and signed an alliance with Russia.