#include using namespace std; const long long INF = 1e18; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int T; cin>>T; while(T--) { long long x, y, D; cin>>D>>x>>y; long long ans = 0; for(long long t=0; tD || j<0 || j>D) break; ans = max(ans, abs(x*i - y*j)); } for(long long t=0; tD || j<0 || j>D) break; ans = max(ans, abs(x*i - y*j)); } cout<