시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 119 26 24 32.432%

문제

두 자연수 A, B가 주어졌을 때, A + N과 B + N의 최소공배수가 최소가 되는 자연수 N을 구하시오.

입력

첫째 줄에 두 자연수 A와 B가 주어진다. A, B는 109보다 크지 않다.

출력

첫째 줄에 N을 출력한다. 만약 답이 여러 개라면 그 중 가장 작은 것을 출력한다.

예제 입력 1

4 10

예제 출력 1

2

힌트

자연수는 1이상의 정수이다.

W3sicHJvYmxlbV9pZCI6IjExNDE0IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiTENNIiwiZGVzY3JpcHRpb24iOiI8cD5cdWI0NTAgXHVjNzkwXHVjNWYwXHVjMjE4IEEsIEJcdWFjMDAgXHVjOGZjXHVjNWI0XHVjODRjXHVjNzQ0IFx1YjU0YywgQSArIE5cdWFjZmMgQiArIE5cdWM3NTggXHVjZDVjXHVjMThjXHVhY2Y1XHViYzMwXHVjMjE4XHVhYzAwIFx1Y2Q1Y1x1YzE4Y1x1YWMwMCBcdWI0MThcdWIyOTQgXHVjNzkwXHVjNWYwXHVjMjE4IE5cdWM3NDQgXHVhZDZjXHVkNTU4XHVjMmRjXHVjNjI0LjxcL3A+XHJcbiIsImlucHV0IjoiPHA+XHVjY2FiXHVjOWY4IFx1YzkwNFx1YzVkMCBcdWI0NTAgXHVjNzkwXHVjNWYwXHVjMjE4IEFcdWM2NDAgQlx1YWMwMCBcdWM4ZmNcdWM1YjRcdWM5YzRcdWIyZTQuIEEsIEJcdWIyOTQgMTA8c3VwPjk8XC9zdXA+XHViY2Y0XHViMmU0IFx1ZDA2Y1x1YzljMCBcdWM1NGFcdWIyZTQuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+XHVjY2FiXHVjOWY4IFx1YzkwNFx1YzVkMCBOXHVjNzQ0IFx1Y2Q5Y1x1YjgyNVx1ZDU1Y1x1YjJlNC4gXHViOWNjXHVjNTdkIFx1YjJmNVx1Yzc3NCBcdWM1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