Get GridLayoutGroup size without spacing

Hi,
I have a GameObject within a Canvas, and I added a GridLayoutGroup component to it.
The GameObject dimensions are:

width: 400px, height: 200px

Let’s call the number of items in the grid: N

My question is simple - how do I know what’s the real width and height of the grid layout after adding a padding and spacing between the items?
Since the padding and the spacing takes space of the actual rectangle area.
For convenience -

Padding - TOP,LEFT,RIGHT,BOTTOM: 15

Spacing - X,Y: 10

I couldn’t find the right formula to calculate that, I hope one of you could help.

Thanks!

realWidth = width - (xPadding2) - ((xSpacingnumCols) - xSpacing);