Can anybody explain me? (GCDMOD)

In the solution i have mentioned in the link when the num1 and num2 are not equal in solve function while calcuting answer why mod is taken with finalanswer and not modulus??

Link : https://www.codechef.com/viewsolution/19708118