The distributive property allows you to pull the g out and you add the numbers in front of each term so
12g + 7g = (12 + 7)g = 19g. You start with a problem involving a variable and by using the distributive property, you get a problem in arithmetic, something you already know. That's the step you are looking for.
For the problem you put up you would simply add the numbers together and keep the g after it
I hope this helps.