Which occurred first Louisiana Purchase or James Madison elected?

Louisiana Purchase