You are given an undirected, complete graph G that contains N vertices. Each edge is colored in either white or black. You are required to determine the number of triplets (i,j,k) (1≤i<j<k≤N) of vertices such that the edges (i,j),(j,k),(i,k) are of the same color.
There are M white edges and N(N−1)2−M black edges.
Input format
Note: The conditions(ui,vi)≠(uj,vj) and (ui,vi)≠(vj,uj) are satisfied for all 1≤i<j≤M.
Output format
Print an integer that denotes the number of triples that satisfy the mentioned condition.
Additional information
The triplets are: {(1,2,3),(1,2,4),(2,3,4),(1,3,4)}.
The graph consisting of only white edges:
The graph consisting of only black edges: