Create zoj1016.py

Optimization needed.