solution to p86
solution to p99