Optimize prob1