//#include //#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll=long long; using intpair=pair; using intpv=vector; using llpair=pair; using llpv=vector; using intvec=vector; using llvec=vector; using intq=queue; using llq=queue; using intmat=vector; using llmat=vector; using pairmat=vector; template using matrix=vector>; template using pque=priority_queue; template using lpque=priority_queue,greater>; #define PI 3.141592653589793 #define INTINF 1<<30 #define LLINF 1LL<<60 #define MPRIME 1000000007 #define MPRIME9 998244353 #define len length() #define pushb push_back #define fi first #define se second #define setpr fixed<()) #define matin(mat,H,W) for(int i__=0; i__>mat[i__][j__] #define out(n) cout< inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline void outmat(T& a, int y, int x) { for(int i=0; i inline void init(T& v) { for(auto &a__: v) cin>>a__; } template inline void init(T& v, N n) { v.resize(n); for(auto &a__: v) cin>>a__; } template void resiz(N n) {} // empty template void resiz(N n, T&& hd, U&&... tl) { hd.resize(n); resiz(n,forward(tl)...); } ll GCD(ll a, ll b) { //最大公約数 if(a==0||b==0) return 0; if(a0) { if(ex&1) result=result*a%p; ex>>=1; a=a*a%p; } return result; } ll Fact(ll x, ll p) { //階乗 ll f=1; for(ll i=2; i<=x; i++) { f*=i; f%=p; } return f; } int DigitNum(ll n) { //桁数 int digit=0; ll div=1LL; while(n/div) { digit++; div*=10; } return digit; } int N,K,X,Y; intvec A; ll res=0; void input() { cin>>N>>K>>X>>Y; A.resize(N); } void solve() { for(int i=0; i>A[i]; A[i]--; A[i]=(A[i]+K-1)/K; } sort(all(A)); int pos=N-1-Y/X; int l=0; if(pos>=0) { l=A[pos]; } res=(ll)Y*l; for(int i=max(0,pos+1); i