Signed GCD calculator