Cuber QQ is interested in locating the best k-degree subgraph in the graph G=(V(G),E(G)).
A subgraph S is a k-degree subgraph of G, if (i) each vertex

has at least k degree in S, (ii) S is connected; and (iii) S is maximal, i.e., any supergraph of S is not a k-degree except S itself.
Then Cuber QQ defines the score of a subgraph S. Before the definition of the score, he firstly defines
- n(S): the number of vertices in subgraph S, i.e., n(S) = |V (S)|;
- m(S): the number of edges in subgraph S, i.e., m(S) = |E(S)|;
- b(S): the number of boundary edges in subgraph S,
;
Then he defines the score of a subgraph is
%3DM%5Ccdot%20m(S)-N%5Ccdot%20n(S)%2BB%5Ccdot%20b(S))
, where M,N,B are given constants.
The higher the score of the subgraph, the better Cuber QQ thinks it is. You are asked to find the best k-degree subgraph in the graph G. If there are many k-degree subgraph with the same score, you should maximize k.