{"problem":{"name":"G. Team Players","description":{"content":"There are $n$ players numbered from $0$ to $n-1$ with ranks. The $i$\\-th player has rank $i$. Players can form teams: the team should consist of three players and **no pair** of players in the team s","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF985G"},"statements":[{"statement_type":"Markdown","content":"There are $n$ players numbered from $0$ to $n-1$ with ranks. The $i$\\-th player has rank $i$.\n\nPlayers can form teams: the team should consist of three players and **no pair** of players in the team should have a conflict. The rank of the team is calculated using the following algorithm: let $i$, $j$, $k$ be the ranks of players in the team and $i &lt; j &lt; k$, then the rank of the team is equal to $A \\cdot i + B \\cdot j + C \\cdot k$.\n\nYou are given information about the pairs of players who **have** a conflict. Calculate the total sum of ranks over all possible valid teams modulo $2^{64}$.\n\n## Input\n\nThe first line contains two space-separated integers $n$ and $m$ ($3 \\le n \\le 2 \\cdot 10^5$, $0 \\le m \\le 2 \\cdot 10^5$) — the number of players and the number of conflicting pairs.\n\nThe second line contains three space-separated integers $A$, $B$ and $C$ ($1 \\le A, B, C \\le 10^6$) — coefficients for team rank calculation.\n\nEach of the next $m$ lines contains two space-separated integers $u_i$ and $v_i$ ($0 \\le u_i, v_i &lt; n, u_i \\neq v_i$) — pair of conflicting players.\n\nIt's guaranteed that each unordered pair of players appears in the input file no more than once.\n\n## Output\n\nPrint single integer — the total sum of ranks over all possible teams modulo $2^{64}$.\n\n[samples]\n\n## Note\n\nIn the first example all $4$ teams are valid, i.e. triples: {0, 1, 2}, {0, 1, 3}, {0, 2, 3} {1, 2, 3}.\n\nIn the second example teams are following: {0, 2, 3}, {1, 2, 3}.\n\nIn the third example teams are following: {0, 1, 2}, {0, 1, 4}, {0, 1, 5}, {0, 2, 4}, {0, 2, 5}, {1, 2, 3}, {1, 2, 4}, {1, 2, 5}.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"有 $n$ 名玩家，编号从 $0$ 到 $n -1$，每位玩家的排名为其编号。第 $i$ 名玩家的排名为 $i$。\n\n玩家可以组成团队：每个团队必须由三名玩家组成，且团队中任意两名玩家之间不得存在冲突。团队的排名按以下算法计算：设团队中三名玩家的排名分别为 $i$、$j$、$k$，且满足 $i < j < k$，则该团队的排名为 $A \\dotop i + B \\dotop j + C \\dotop k$。\n\n你将获得所有存在冲突的玩家对的信息。请计算所有可能的有效团队的排名总和，结果对 $2^{64}$ 取模。\n\n第一行包含两个用空格分隔的整数 $n$ 和 $m$（$3 \\leq n \\leq 2 \\dotop 10^5$，$0 \\leq m \\leq 2 \\dotop 10^5$），分别表示玩家数量和冲突对的数量。\n\n第二行包含三个用空格分隔的整数 $A$、$B$ 和 $C$（$1 \\leq A, B, C \\leq 10^6$），表示计算团队排名的系数。\n\n接下来的 $m$ 行，每行包含两个用空格分隔的整数 $u_i$ 和 $v_i$（$0 \\leq u_i, v_i < n$，$u_i \\neq v_i$），表示一对存在冲突的玩家。\n\n保证输入文件中每个无序玩家对最多只出现一次。\n\n请输出一个整数——所有可能的有效团队的排名总和对 $2^{64}$ 取模的结果。\n\n在第一个示例中，所有 $4$ 个团队都是有效的，即三元组：{0, 1, 2}、{0, 1, 3}、{0, 2, 3}、{1, 2, 3}。\n\n在第二个示例中，有效的团队为：{0, 2, 3}、{1, 2, 3}。\n\n在第三个示例中，有效的团队为：{0, 1, 2}、{0, 1, 4}、{0, 1, 5}、{0, 2, 4}、{0, 2, 5}、{1, 2, 3}、{1, 2, 4}、{1, 2, 5}。\n\n## Input\n\n第一行包含两个用空格分隔的整数 $n$ 和 $m$（$3 \\leq n \\leq 2 \\dotop 10^5$，$0 \\leq m \\leq 2 \\dotop 10^5$），分别表示玩家数量和冲突对的数量。第二行包含三个用空格分隔的整数 $A$、$B$ 和 $C$（$1 \\leq A, B, C \\leq 10^6$），表示计算团队排名的系数。接下来的 $m$ 行，每行包含两个用空格分隔的整数 $u_i$ 和 $v_i$（$0 \\leq u_i, v_i < n$，$u_i \\neq v_i$），表示一对存在冲突的玩家。保证输入文件中每个无序玩家对最多只出现一次。\n\n## Output\n\n请输出一个整数——所有可能的有效团队的排名总和对 $2^{64}$ 取模的结果。\n\n[samples]\n\n## Note\n\n在第一个示例中，所有 $4$ 个团队都是有效的，即三元组：{0, 1, 2}、{0, 1, 3}、{0, 2, 3}、{1, 2, 3}。在第二个示例中，有效的团队为：{0, 2, 3}、{1, 2, 3}。在第三个示例中，有效的团队为：{0, 1, 2}、{0, 1, 4}、{0, 1, 5}、{0, 2, 4}、{0, 2, 5}、{1, 2, 3}、{1, 2, 4}、{1, 2, 5}。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of players, numbered $ 0 $ to $ n-1 $, where player $ i $ has rank $ i $.  \nLet $ m \\in \\mathbb{Z} $ be the number of conflicting unordered pairs.  \nLet $ A, B, C \\in \\mathbb{Z}^+ $ be fixed coefficients.  \nLet $ E \\subseteq \\binom{[n]}{2} $ be the set of conflicting pairs, where $ [n] = \\{0, 1, \\dots, n-1\\} $.  \n\nA valid team is a triple $ \\{i, j, k\\} \\in \\binom{[n]}{3} $ such that no pair in $ \\{\\{i,j\\}, \\{i,k\\}, \\{j,k\\}\\} $ belongs to $ E $.  \n\nFor a valid team with ranks $ i < j < k $, its rank is defined as:  \n$$\nR(i,j,k) = A \\cdot i + B \\cdot j + C \\cdot k\n$$\n\n**Constraints**  \n1. $ 3 \\leq n \\leq 2 \\cdot 10^5 $  \n2. $ 0 \\leq m \\leq 2 \\cdot 10^5 $  \n3. $ 1 \\leq A, B, C \\leq 10^6 $  \n4. Each conflicting pair $ \\{u_i, v_i\\} \\in E $ satisfies $ u_i \\ne v_i $, and all pairs are distinct.  \n\n**Objective**  \nCompute:  \n$$\n\\sum_{\\substack{\\{i,j,k\\} \\in \\binom{[n]}{3} \\\\ \\text{no pair in } E}} \\left( A \\cdot i + B \\cdot j + C \\cdot k \\right) \\mod 2^{64}\n$$  \nwhere $ i < j < k $ in each triple.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF985G","tags":["combinatorics"],"sample_group":[["4 0\n2 3 4","64"],["4 1\n2 3 4\n1 0","38"],["6 4\n1 5 3\n0 3\n3 5\n5 4\n4 3","164"]],"created_at":"2026-03-03 11:00:39"}}