p057.py: solution to p057