Can anybody explain "SUMAGCD" in simpler language

i went through the editorial but i did not get the approach at all, can anybody please tell me an approach for this question