A Möbius strip is a surface with a single side and a single boundary edge. You can build one from a strip of paper: give one of the short ends a half-turn twist, then glue the two short ends together.
Start with a rectangular strip of paper whose two faces are each covered by a square grid of size m×n with m≤n (m squares across the width, n squares along the length). Twisting one short end by a half turn and gluing the short ends together joins the two faces into one continuous surface, so the resulting Möbius strip has size m×2n: m squares across the width and 2n squares all the way around the loop. For example, a Möbius strip of size 5×100 has m=5 and 2n=100 (that is, n=50).
Two squares are adjacent when they share a full side, except along the single boundary edge of the strip. An ant stands on one square and moves only from a square to an adjacent one; it can never step across the boundary edge. The distance between two squares is the least number of moves the ant needs to get from one to the other (equivalently, the number of squares it enters, not counting the square it started on), so two adjacent squares are at distance 1.
The average distance of a Möbius strip of size m×2n is the average of the distances taken over every ordered pair of squares, including each square paired with itself (which contributes distance 0). For example, a Möbius strip of size 1×2n has average distance 2n.
Given the size of a Möbius strip, output its average distance.
The first line contains the number of test cases T. Each of the following T lines contains two integers m and n (1≤m≤n≤1,000,000), describing a Möbius strip of size m×2n.
For each test case, print one line with the average distance of that Möbius strip, rounded to the nearest tenth so that it shows exactly one digit after the decimal point.