solution to p6: 25164150
solution to p7: 104743