CF489D Unbearable Controversy of Being
Description
Tomash keeps wandering off and getting lost while he is walking along the streets of Berland. It's no surprise! In his home town, for any pair of intersections there is exactly one way to walk from one intersection to the other one. The capital of Berland is very different!
Tomash has noticed that even simple cases of ambiguity confuse him. So, when he sees a group of four distinct intersections $ a $ , $ b $ , $ c $ and $ d $ , such that there are two paths from $ a $ to $ c $ — one through $ b $ and the other one through $ d $ , he calls the group a "damn rhombus". Note that pairs $ (a,b) $ , $ (b,c) $ , $ (a,d) $ , $ (d,c) $ should be directly connected by the roads. Schematically, a damn rhombus is shown on the figure below:
Other roads between any of the intersections don't make the rhombus any more appealing to Tomash, so the four intersections remain a "damn rhombus" for him.
Given that the capital of Berland has $ n $ intersections and $ m $ roads and all roads are unidirectional and are known in advance, find the number of "damn rhombi" in the city.
When rhombi are compared, the order of intersections $ b $ and $ d $ doesn't matter.
Input Format
Tomash keeps wandering off and getting lost while he is walking along the streets of Berland. It's no surprise! In his home town, for any pair of intersections there is exactly one way to walk from one intersection to the other one. The capital of Berland is very different!
Tomash has noticed that even simple cases of ambiguity confuse him. So, when he sees a group of four distinct intersections $ a $ , $ b $ , $ c $ and $ d $ , such that there are two paths from $ a $ to $ c $ — one through $ b $ and the other one through $ d $ , he calls the group a "damn rhombus". Note that pairs $ (a,b) $ , $ (b,c) $ , $ (a,d) $ , $ (d,c) $ should be directly connected by the roads. Schematically, a damn rhombus is shown on the figure below:
Other roads between any of the intersections don't make the rhombus any more appealing to Tomash, so the four intersections remain a "damn rhombus" for him.
Given that the capital of Berland has $ n $ intersections and $ m $ roads and all roads are unidirectional and are known in advance, find the number of "damn rhombi" in the city.
When rhombi are compared, the order of intersections $ b $ and $ d $ doesn't matter.
Output Format
Print the required number of "damn rhombi".