class mystere:
    def __init__(self):
        self.Liste = [ ]

    def add(self, x):
        if len(self.Liste) == 0 or x >= self.Liste[ len(self.Liste)-1 ]:
            self.Liste.append(x)
        elif x < self.Liste[0]:
            self.Liste = [x] + self.Liste
        else:
            for i in range( len(self.Liste) ):
                if x > self.Liste[i] and x <= self.Liste[i+1]:
                    self.Liste = self.Liste[:i+1] + [x] + self.Liste[i+1:]

    def ecc(self):
        E, prev = [], 0
        for nb in self.Liste:
            prev = prev + nb
            E.append(prev)
        return E

L = mystere()

for i in [78,89,10,50,7]:
    L.add(i)

print(L.Liste)
print(L.ecc())