z=zipWith f a=map(/sum a).foldr1(z(+)).z(map.(*))a main = print $ [f [2,6,2,10] [[0,2],[3,4],[0,1],[1,1]], f [2,4,1] [[3,1],[0,0],[1,4]]]