sum g_i for i= 1 to 5