{"problem":{"name":"Points and Comparison","description":{"content":"**Pay attention to the special input format.** There are $N$ points $(X_i,Y_i)$ in the $xy$\\-plane. You are given these points in the input. Also, $Q$ pairs of integers $(A_j,B_j)$ are given.   Define","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":10000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc344_g"},"statements":[{"statement_type":"Markdown","content":"**Pay attention to the special input format.**\nThere are $N$ points $(X_i,Y_i)$ in the $xy$\\-plane. You are given these points in the input.\nAlso, $Q$ pairs of integers $(A_j,B_j)$ are given.  \nDefine $f(A_j,B_j)$ as the number of indices $i$ satisfying $Y_i \\ge A_j \\times X_i + B_j$.\nFind $\\displaystyle \\sum^{Q}_{j=1} f(A_j,B_j)$.\nHere, $Q$ gets very large, so $(A_j,B_j)$ are not given directly.  \nInstead, $G_0$, $R_a$, and $R_b$ are given, and $(A_j,B_j)$ are generated as follows:\n\n*   First, for $n \\ge 0$, define $G_{n+1} = (48271 \\times G_n) \\mod (2^{31}-1)$.\n*   For $j=1,2,\\dots,Q$, generate $(A_j,B_j)$ as follows:\n    *   $A_j = -R_a + (G_{3j - 2} \\mod (2 \\times R_a + 1) )$\n    *   $B_j = -R_b + ((G_{3j - 1} \\times (2^{31}-1) + G_{3 j}) \\mod (2 \\times R_b + 1) )$\n\nFrom this method, it can be shown that $A_j$ and $B_j$ satisfy the following constraints:\n\n*   $-R_a \\le A_j \\le R_a$\n*   $-R_b \\le B_j \\le R_b$\n\n## Constraints\n\n*   All input values are integers.\n*   $1 \\le N \\le 5000$\n*   $1 \\le Q \\le 10^7$\n*   $|X_i|, |Y_i| \\le 10^8$\n*   The pairs $(X_i,Y_i)$ are distinct.\n*   $0 \\le G_0 < (2^{31}-1)$\n*   $0 \\le R_a \\le 10^8$\n*   $0 \\le R_b \\le 10^{16}$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$X_1$ $Y_1$\n$X_2$ $Y_2$\n$\\vdots$\n$X_N$ $Y_N$\n$Q$\n$G_0$ $R_a$ $R_b$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc344_g","tags":[],"sample_group":[["7\n2 -2\n-1 -2\n0 1\n2 1\n-2 2\n1 2\n0 -1\n10\n1 5 5","36\n\nThis input contains ten questions.  \nThe generated $(A_j,B_j)$ are $(-2,4),(0,2),(-4,-2),(4,-5),(3,1),(-1,3),(2,-5),(3,-1),(3,5),(3,-2)$."]],"created_at":"2026-03-03 11:01:14"}}