A Model Railroad

No attempts yetTime limit1sMemory limit128 MB

Problem

John is a model railroad enthusiast. He enjoys these railroads so much that he wants to build them as long as possible, and he wants to connect with other enthusiasts and run their trains too. To make his railroad easy to transport and to connect to other railroads, each owner builds his railroad in modules of standard sizes that fit together neatly.

John only builds rectangular modules. Every module has exactly two connection points on its edge: one on the bottom edge and one on the top edge. Inside a module the track runs between the two connection points, and it must begin and end perpendicular to the wall at each connection point.

To keep things simple, John uses only two kinds of rails: straight rails and curved rails that bend by 90° (a curved rail can turn either left or right). Each rail, straight or curved, occupies a 10 × 10 cm square.

John wants each module's track to be as long as possible given how many rails he has. Write a program that computes the largest number of rails he can place in a module.

A solution for a 6 × 4 module starting at (1, 1) and ending at (5, 4) when John has 15 straight and 5 curved rails.

Input

The first line contains the number of modules to build. Each module is then described by three lines:

  1. The size of the module: two integers, the width and the depth, given as multiples of 10 cm (that is, the number of cells along each side). Both values are at most 10.
  2. The two connection points, given as x-coordinates: the connection on the bottom row followed by the connection on the top row. Each x-coordinate is an integer from 1 to the width.
  3. The number of straight rails and the number of curved rails available for this module.

A module is a grid of width × depth cells, each 10 × 10 cm, and every cell holds at most one rail. The track is a path of cells that never reuses a cell; it enters the bottom connection cell perpendicular to the bottom wall and leaves the top connection cell perpendicular to the top wall. A cell in which the track goes straight through uses one straight rail; a cell in which the track makes a 90° turn uses one curved rail.

Output

For each module, print one line.

If a track can be built, print Module i: Longest railroad has N rails., where i is the module number (starting from 1) and N is the greatest possible number of rails.

If no legal track can be built with the available rails, print Module i: No such railroad.