Help me in solving AVGPERM problem

My issue

My code

# cook your dish here

Problem Link: AVGPERM Problem - CodeChef