Bear and Stickman
Practice
4.4 (39 votes)
Mathematics
Open
Approved
Easy Medium
Mathamatics
Problem
19% Success 2243 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

View Russian Translation

Limak is a little bear who loves to play with graphs. Recently, he defined a new structure in a graph and called it a stickman.

A stickman is a set of 7 different vertices and 6 edges. Vertices should be connected by edges as in the image below.

single stickman

You can see here two legs, two arms and a head. Formally, one vertex (the one between arms) must be connected to four other vertices and one of these four must be connected to two more vertices.

Limak has an undirected graph with N vertices and M edges. He asks you a favor. Could you count how many stickmen there are in Limak's graph, modulo 10^9+7?

A stickman is defined by a set of 7 vertices and 6 edges - order doesn't matter here. It means that we shouldn't distinguish legs. Moreover, we shouldn't distinguish head and arms.

Input format:

The first line contains two integers N and M, denoting number of vertices and number of edges, respectively. Vertices are numbered 1 through N.

Each of the next M lines contains two different vertices connected by an edge. There is at most one edge between every two vertices.

Output format:

In the single line print the number of stickmen modulo 10^9+7.

Constraints:

7 <= N <= 200
0 <= M <= N * (N-1) / 2

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
9 votes
Tags:
Basic MathAlgorithmsMath
Points:30
62 votes
Tags:
MathematicsOpenApprovedEasy-MediumMathamatics
Points:30
6 votes
Tags:
MathematicsEasy-MediumMathematicsMathamatics