Intervals#2945

Intervals

2 seconds
64 megabytes
Very hard

On the real line, there are intervals, each with endpoints at integer positions. These endpoints are not included in the intervals. You are given which pairs of intervals intersect and which do not. Using this information, determine the minimum possible total length of all intervals. Note that every interval must have length at least .

Input

The first line contains two integers: (1 \leq n \leq 1234), the number of intervals, and (0 \leq m \leq n(n-1)/2), the number of pairs of intervals that intersect. The next lines contain pairs of indices of intersecting intervals. Intervals are numbered from to n-1. If a pair of intervals is not listed, then they do not intersect. It is guaranteed that it is possible to construct a set of intervals that matches the given information.

Output

Print the minimum possible total length of all intervals. Intervals cannot have zero length.

Examples

Example 1

Loading
Loading