#include #include namespace my{ using namespace std; #define done(...) return pp(__VA_ARGS__) #define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__) #define FO(n) for(ll ij=n;ij--;) #define FOR(i,...) for(auto[i,i##stop,i##step]=range(0,__VA_ARGS__);i>T;while(T--)my::solve();}namespace my{ void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<auto range(bool s,A...a){arrayr{0,0,1};ll I=0;((r[I++]=a),...);if(!s&&I==1)swap(r[0],r[1]);r[0]-=s;return r;} constexpr char nl=10; constexpr char sp=32; constexpr auto zz(auto x){return x<0?-x:x;} auto min(const auto&...a){return min(initializer_list>{a...});} void lin(auto&...a){(cin>>...>>a);} templatevoid pp(const auto&...a){ll n=sizeof...(a);((cout<0,c)),...);cout<common_type_tgcd(T a,U b){return b?gcd(b,a%b):a>0?a:-a;} templateauto gcd(const A&...a){common_type_tr=0;((r=gcd(r,a)),...);return r;} multiple_testcases void solve(){ LL(D,a,b); if(a