P31 fixed

Bruce force solution to P31.