Frederik IV (1671-1730), kung av Danmark och Norge