#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl '\n'
void GordenGhost();
const ll mod = 998244353;
ll qpow(ll a,ll b){
ll res=1;
while(b){
if (b&1) res=res*a%mod;
a=a*a%mod;
b>>=1;
}
return res;
}
ll inv(ll a){return qpow(a,mod-2);}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
int t;
cin>>t;
while(t--)
GordenGhost();
return 0;
}
void GordenGhost(){
ll ax,bx,ay,by;
cin>>ax>>ay>>bx>>by;
ll fz=ax*by%mod;
ll mu=ay*by%mod+mod-(ay-ax)*(by-bx)%mod;
mu%=mod;
ll ans=fz*inv(mu)%mod;
cout<<ans<<'\n';
}
射击比赛(2023年安徽大学第十五届程序设计竞赛)
最新推荐文章于 2024-07-18 17:40:16 发布