#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; ull seed; int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return (seed >> 33); } #define PART 3000000 int sn; vector ma[PART+10]; ll sma[PART+10]; vector a; inline int solve(ll x){ ll part = (2LL<<31)/PART; ll pos = x/part; ll ret = sma[pos]; if(ma[pos].size() == 0) return ret; int m; int l = 0, r = ma[pos].size(); while(l> n >> q >> seed; for (int i = 0; i < 10000; i++) next(); for (int i = 0; i < n; i++){ int x = next(); a.push_back(x); } sort(ALLOF(a)); ll part = (2LL<<31)/PART; for(int i=0; i