Modified prob_5.py