time-consuming version of problem 60
problem 63 solved