This page is still under construction.

Parts of this page are still being built. What you see may change.

You've goat me stumped

Time limit10sMemory limit512 MB

Summary
Given two stakes distance l apart and a rope of length r threaded through a collar, compute the area the goat can reach, rounded to the nearest 100 square meters.
Level

Medium7 of 10

Topics
Geometry, Math, Implementation
Solved
No attempts yet

Problem

When leaving goats to graze in a field, in order to ensure that they remain in place, it is customary to drive a wooden stake in the middle of the field and tether the goat to it to ensure that it does not run away. This allows the goat to roam within a disk-shaped pasture.

In the far region of Straitmeadows, the fields are long and narrow. This odd geometry has led to an even more peculiar habit of the shepherds. They put a collar on the goat and pass a rope through it (so that the rope can move freely), and they then tie each end of the rope to a stake. This allows the goat to move along the rope but remain sufficiently close to the two stakes.

To ensure the goat doesn't starve, the shepherds need to know (very roughly) which area of grass the goat can graze in this fashion. You will assume that the goat and the stakes are 0-dimensional objects, that the rope is 1-dimensional, and that the field is a plane.

Input

The input file consists of multiple test cases. The first line of the input file consists of a single integer cc indicating the number of test cases. Each test case follows and consists of a single line which consists of two integers ℓ\ell and rr separated by a single space. The integer 0≤ℓ≤300 \leq \ell \leq 30 indicates the distance between the two stakes in meters. The integer ℓ≤r≤50\ell \leq r \leq 50 indicates the length of the rope in meters.

Output

For each test case in the input, your program should produce one line consisting of a single integer which is the area of pasture that the goat can graze, rounded to the nearest hundred of square meters.

Hint

Examples1

  1. Example 1

    Input
    3
    0 2
    10 30
    30 50
    
    Expected output
    0
    700
    1600