(define (g x y)
  (if (zero? y)
      x
      (g y (remainder x y))))
