#include #include using namespace std; int g_seed; unsigned int fastrand() { g_seed = 214013 * g_seed + 2531011; return (g_seed >> 16) & 0x7FFF; } int nextinc() { return 1 + (fastrand() & 0b111); } int n, A; const int LIM = 10000; const int PULL = 9000; int B[11111]; int offset = 0; int m3[111], m5[111]; unsigned long long multiplier = 1ULL; const unsigned long long mc = 139ULL; unsigned long long ans = 0ULL; void relocate() { int i,j; for (i=0;i>n>>A>>g_seed; mod3 = A % 3; mod5 = A % 5; if (A > 10) { offset = A - 10; A = 10; } B[A - mod3 * mod5]++; for (i=1;i LIM) relocate(); //cout<