First version of recuit for problem 1