Add problem 51 (slow version)