human
A pair of positive integers (a,b) is called special if ⌊ a/b ⌋ = a mod b. Here, ⌊ a/b ⌋ is the result of the integer division between a and b, while a mod b is its remainder.

You are given two integers x and y. Find the number of special pairs (a,b) such that 1≤ a ≤ x and 1 ≤ b ≤ y.

Input

The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases.

The only line of the description of each test case contains two integers x, y (1 ≤ x,y ≤ 10^9).

Output

For each test case print the answer on a single line.

Example

Input

9
3 4
2 100
4 3
50 3
12 4
69 420
12345 6789
123456 789
12345678 9

Output

1
0
2
3
5
141
53384
160909
36

Note

In the first test case, the only special pair is (3, 2).

In the second test case, there are no special pairs.

In the third test case, there are two special pairs: (3, 2) and (4, 3).
Solve the task in PYTHON3.
 ... What is a Python program to find the number of special pairs (a,b) such that 1≤ a ≤ x and 1 ≤ b ≤ y?
assistant
#Here is Python program to find the number of special pairs (a,b) such that 1≤ a ≤ x and 1 ≤ b ≤ y.

"""
9
3 4
2 100
4 3
50 3
12 4
69 420
12345 6789
123456 789
12345678 9

1
3 4

1
12345678 9

[  (3, 2)]
[  (4, 3), (8, 3)]
[  (5, 4), (10, 4), (15, 4)]
[  (6, 5), (12, 5), (18, 5), (24, 5)]
[  (7, 6), (14, 6), (21, 6), (28, 6), (35, 6)]
[  (8, 7), (16, 7), (24, 7), (32, 7), (40, 7), (48, 7)]
[  (9, 8), (18, 8), (27, 8), (36, 8), (45, 8), (54, 8), (63, 8)]
[ (10, 9), (20, 9), (30, 9), (40, 9), (50, 9), (60, 9), (70, 9), (80, 9)]
[ (11, 10), (22, 10), (33, 10), (44, 10), (55, 10), (66, 10), (77, 10), (88, 10), (99, 10)]
[ (12, 11), (24, 11), (36, 11), (48, 11), (60, 11), (72, 11), (84, 11), (96, 11), (108, 11), (120, 11)]
[ (13, 12), (26, 12), (39, 12), (52, 12), (65, 12), (78, 12), (91, 12), (104, 12), (117, 12), (130, 12), (143, 12)]
"""

# def floor_sqrt(a):
#     l = 1
#     r = a
#
#     while l <= r:
#         m = l + (r - l) // 2
#
#         if m*m > a:
#             r = m - 1
#         else:
#             l = m + 1
#
#     return l - 1

# def series_sum(i, n):
#     return n * (i + n) // 2

def main():
    t = int(input())

    ans = []
    for _ in range(t):
        x, y = map(int, input().split())

        x = min(y * y, x)
        y = min(x - 1, y)

        cnt = 0
        rem = 1
        while rem*rem <= x:
            cnt += max(0, min(y, x // rem - 1) - rem)
            rem += 1

        ans.append(str(cnt))

        # if a >= b - 1:
        #     result = series_sum(1, b - 1)

        # floor_sqrt = floor_sqrt(a)
        # if floor_sqrt >= b:  # b or b - 1
        #     result = series_sum(1, b - 1)
        # else:
        #     rect = (floor_sqrt - 1) * (b - floor_sqrt)
        #     triangle = series_sum(1, floor_sqrt - 1)
        #     # result = series_sum(1, b - 1) - triangle - rect
        #     result = rect + triangle
        #
        #     print(floor_sqrt, rect, triangle)
        # ans.append(str(result))

    print('\n'.join(ans))

def tests():
    a = 10000
    b = 12

    a = min(b * b, a)
    b = min(a - 1, b)

    cnt = 0
    for cb in range(2, b + 1):
        pairs = []
      ...