Working Python solution, 37.11 score.