#include <iostream>
#include <cmath>
using namespace std;

int gcd(int x, int y){
	x = abs(x);
	y = abs(y);
	if(y == 0)
		return x;
	if(y > 0)
		return gcd(y, x % y);
	return 0;
}

int main(){
	cout << gcd(20 ,30) << endl;
	cout << gcd(112, 42) << endl;
	cout << gcd(-112,42) << endl;
	return 0;
}
