#include "bits/stdc++.h" using namespace std; #define int long long #define MAX_N (200005) #define INF (1LL<<60) #define debug(x) cerr << #x <<":"<< x << endl; #define debugVec(x) for(auto p:(x)) cerr << p <<" "; cerr << endl; #define debugVecPair(x) for(auto p:(x)) cerr << #x <<": "<< p.first <<" "<< p.second << endl; #define debugIdx(i, x) cerr << #i <<" : "<< i <<" "<< #x <<" : "<< x << endl; const int MOD = (int)1e9+7; // 約数の列挙O(√n) vector divisor(int n){ vector res; for(int i=1; i*i<=n; i++){ if(n%i==0){ res.push_back(i); // n の約数が i の時、n/i も n の約数になる if(i!=n/i) res.push_back(n/i); } } return res; } signed main() { int A, B; cin >> A >> B; vector C; C = divisor(A+B); int ans=INF; for(int i=0; i