#include using namespace std; using ll = long long; const ll INF = 1ll << 60; #define REP(i, n) for(ll i =0; i < ll(n); i++) template using V = vector; template bool chmax(A& a, B b) { return a bool chmin(A& a, B b) { return b> a >> b; for(int x = 1; x <= 100000; x++) { if(x % a == b % x) { cout << x << '\n'; return; } } assert(0); } int main() { cin.tie(0)->sync_with_stdio(0); testcase(); }