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).
//package CodeForces.Contests.C701;

import java.util.*;
import java.lang.*;
import java.io.*;

public class FloorAndMod {
    BufferedReader input;
    BufferedWriter output;
    StringTokenizer st;
    
    
    // My Solution
    void solve() throws IOException {
        int t = getInt();
        while (t-->0){
            long x = getLong();
            long y = getLong();
            long count = 0;
            int i = 1;
            while (true){
                long b = i+1;
                long a = (b*i)+i;
                if(b>y || a>x)
                    break;
                long da = (x-a+i)/i;
                long db = (y-b+1);
                if(da==0)
                    break;
                count += Math.max(Math.min(da, db), 0);
                i++;
            }
            print(count+"\n");
        }
    }
    
    
    // Some basic functions
    int min(int...i){
        int min = Integer.MAX_VALUE;
        for (int value : i) min = Math.min(min, value);
        return min;
    }
    int max(int...i){
        int max = Integer.MIN_VALUE;
        for (int value : i) max = Math.max(max, value);
        return max;
    }
    // Printing stuff
    void print(int... i) throws IOException {
        for (int value : i) output.write(value + " ");
    }
    void print(long... l) throws IOException {
        for (long value : l) output.write(value + " ");
    }
    void print(String... s) throws IOException {
        for (String value : s) output.write(value);
    }
    void nextLine() throws IOException {
        output.write("\n");
    }
    // Taking Inputs
    int[][] getIntMat(int n, int m) throws IOException {
        int[][] mat = new int[n][m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                mat[i][j] = getInt();
        return mat;
    }
    char[][] getCharMat(int n, int m) throws IOException {
        char[][] mat = new char[n][m];
        for (int i = 0; i < n; i++) {
            String s = input.readLine();
            for (int j = 0; j < m; j++) 
                mat[i][j] = s.charAt(j);
        }
        return mat;
    }
    int getInt() throws IOException {
        if(st ==null || !st.hasMoreTokens())
            st = new StringTokenizer(input.readLine());
        return Integer.parseInt(st.nextToken());
    }
    int[] getInts(int n) throws IOException {
        int[] a = new int[n];
        StringTokenizer st = new StringTokenizer(input.readLine());
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(st.nextToken());
        return a;
    }
    long getLong() throws IOException {
        if(st==null || !st.hasMoreTokens())
            st = new StringTokenizer(input.readLine());
        return Long.parseLong(st.nextToken());
    }
    long[] getLongs(int n) throws IOException {
        long[] a = new long[n];
        StringTokenizer st = new StringTokenizer(input.readLine());
        for (int i = 0; i < n; i++)
            a[i] = Long.parseLong(st.nextToken());
        return a;
    }
    // Checks whether the code is running on OnlineJudge or LocalSystem
    boolean isOnlineJudge() {
        if (System.getProperty("ONLINE_JUDGE") != null)
            return true;
        try {
            return System.getProperty("LOCAL")==null;
        } catch (Exception e) {
            return true;
        }
    }
    // Handling CodeExecution
    public static void main(String[] args) throws Exception {
        new FloorAndMod().run();
    }
    void run() throws IOException {
        // Defining Input Streams
        if (isOnlineJudge()) {
            input = new BufferedReader(new InputStreamReader(System.in));
            output = new BufferedWriter(new OutputStreamWriter(System.out));
        } else {
            input = new BufferedReader(new FileReader("input.txt"));
            output = new BufferedWriter(new FileWriter("output.txt"));
        }
        // Running Logic
        solve();
        output.flush();
        // Run example test cases
        if (!isOnlineJudge()) {
            BufferedReader output = new BufferedReader(new FileReader("output.txt"));
            BufferedReader answer = new BufferedReader(new FileReader("answer.txt"));
            StringBuilder outFile = new StringBuilder();
            StringBuilder ansFile = new StringBuilder();
            String temp;
            while ((temp = output.readLine()) != null)
                outFile.append(temp.trim());
            while ((temp = answer.readLine()) != null)
                ansFile.append(temp.trim());
            if (outFile.toString().equals(ansFile.toString()))
                System.out.println("Test Cases Passed!!!");
            else
                System.out.println("Failed...");
        }
    }
}