modified soluce.py