{"problem":{"name":"Ai + Bj + Ck = X (1 <= i, j, k <= N)","description":{"content":"You are given integers $N,A,B,C,X$. Find the number of triples of integers $(i,j,k)$ that satisfy all of the following conditions. *   $1 \\le i,j,k \\le N$ *   $Ai+Bj+Ck=X$","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc315_g"},"statements":[{"statement_type":"Markdown","content":"You are given integers $N,A,B,C,X$. Find the number of triples of integers $(i,j,k)$ that satisfy all of the following conditions.\n\n*   $1 \\le i,j,k \\le N$\n*   $Ai+Bj+Ck=X$\n\n## Constraints\n\n*   All input values are integers.\n*   $1 \\le N \\le 10^6$\n*   $1 \\le A,B,C \\le 10^9$\n*   $1 \\le X \\le 3 \\times 10^{15}$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $A$ $B$ $C$ $X$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc315_g","tags":[],"sample_group":[["5 3 1 5 15","3\n\nThe following three triples satisfy the conditions.\n\n*   $(1,2,2)$ : $3 \\times 1 + 1 \\times 2 + 5 \\times 2 = 15$\n*   $(2,4,1)$ : $3 \\times 2 + 1 \\times 4 + 5 \\times 1 = 15$\n*   $(3,1,1)$ : $3 \\times 3 + 1 \\times 1 + 5 \\times 1 = 15$"],["1 1 1 1 1","0"],["100000 31415 92653 58979 1000000000","2896"]],"created_at":"2026-03-03 11:01:14"}}