Interactions among multiple three-dimensional bodies in water waves: an exact algebraic method