On the optimization of conservation law models at a junction with inflow and flow distribution controls