Automatic Engineering of Long Prompts