Hi everybody, I was triying this problem Sphere Online Judge (SPOJ) - Problem GCD3. I have no clue on how to go about it. Could someone kindly give me a few pointers on how to start?

Thanks.

(P.S It is my first post here, kindly excuse me if my approach is incorrect. Thanks.)