namespace Gcd { public struct PairWithGcdVR : PairWithGcdV { private int p, q; public int P {get {return p;}} public int Q {get {return q;}} public void Set (int p, int q) { this.p = p; this.q = q; } public int Gcd () { if (q == 0) { return System.Math.Abs(p); } else { PairWithGcdV next = new PairWithGcdVR(); next.Set(q, p % q); return next.Gcd(); } } } }