{"raw_statement":[{"iden":"problem statement","content":"The republic of AtCoder has $N$ cities numbered $1$ through $N$ and $M$ roads numbered $1$ through $M$.\nRoad $i$ leads from City $A_i$ to City $B_i$, but you cannot use it to get from City $B_i$ to City $A_i$.\nPuma is planning her journey where she starts at some city, travels along zero or more roads, and finishes at some city.\nHow many pairs of cities can be the origin and destination of Puma's journey? We distinguish pairs with the same set of cities in different orders."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2000$\n*   $0 \\leq M \\leq \\min(2000,N(N-1))$\n*   $1 \\leq A_i,B_i \\leq N$\n*   $A_i \\neq B_i$\n*   $(A_i,B_i)$ are distinct.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $B_1$\n$\\vdots$\n$A_M$ $B_M$"},{"iden":"sample input 1","content":"3 3\n1 2\n2 3\n3 2"},{"iden":"sample output 1","content":"7\n\nWe have seven pairs of cities that can be the origin and destination: $(1,1),(1,2),(1,3),(2,2),(2,3),(3,2),(3,3)$."},{"iden":"sample input 2","content":"3 0"},{"iden":"sample output 2","content":"3\n\nWe have three pairs of cities that can be the origin and destination: $(1,1),(2,2),(3,3)$."},{"iden":"sample input 3","content":"4 4\n1 2\n2 3\n3 4\n4 1"},{"iden":"sample output 3","content":"16\n\nEvery pair of cities can be the origin and destination."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}