Sum a multidimensional list in python

How can i compute this :

to obtain this:

thanks

You can use collections.defaultdict


Thanks @raymonad for the alternate, cleaner, solution: