S_2 = Reorder(Table(S, i_0, i_1), i_1, i_0)
#A#1 = Reorder(Aggregate(add, 0, Reorder(MapJoin(mul, MapJoin(mul, Table(A, i, k), Table(B, j, k)), Table(S_2, i, j)), i, j, k), k), i, j)
return #A#1
