priority_queuea;ll x,s,b;{rd(x);REP(x)rd(x),a.push(x),s+=x;rd(x);REP(x){for(rd(x);b=a.top(),b/x;a.pop(),a.push(b%x))s+=b%x-b;wt(s);}}