gcd & cut matrix