magic box problem