Space climate and space weather over the past 400 years: 1. The power input to the magnetosphere