Updated p103.py with a solution, but unbearably slow