Mixed carton sizes make one formula insufficient. The answer is a line by line table, not a bigger box.