how to calculate Rg