Help me in solving MTM problem

My issue

My code

import bisect
t=int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    c = 0
    while len(a) > 1:
        e = a.pop(0) + a.pop(0)
        c += e
        bisect.insort_left(a, e)  
    print(c)

Problem Link: CodeChef: Practical coding for everyone

@konda_2003
whats wrong with your code , its working absolutely fine.