Solve #83 in Python.