This page is still under construction.

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

Covering an equilateral triangle

Time limit1sMemory limit256 MB

Summary
Cover an equilateral triangle of side A with the smallest possible number of side-B equilateral triangles, which is (A/B) squared.
Level

Easy1 of 10

Topics
Math
Solved
No attempts yet

Problem

You want to cover an equilateral triangle with side length AA completely by equilateral triangles with side length BB. You may use as many small triangles as you like, and you may flip a small triangle upside down.

The two integers AA and BB satisfy B≤AB \le A, and AA is divisible by BB. Find the minimum number of small triangles needed to cover the large one.

Input

The first line contains the number of test cases TT (T≤100T \le 100).

Each of the next TT lines contains one test case: two integers AA and BB (1≤B≤A≤1 0001 \le B \le A \le 1\,000, BB divides AA).

Output

For each test case, print on its own line the minimum number of equilateral triangles with side length BB that cover an equilateral triangle with side length AA completely.

Examples4

  1. Example 1

    Input
    2
    2 1
    3 3
    
    Expected output
    4
    1
    
  2. Example 2

    Input
    1
    1 1
    
    Expected output
    1
    
  3. Example 3

    Input
    1
    1000 1
    
    Expected output
    1000000
    
  4. Example 4

    Input
    1
    1000 1000
    
    Expected output
    1