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).
import java.io.*;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;

public class Main {

    public static void main(String[] args) {

        Parser parser = Parser.getInstance();
        int t = parser.parseInt();
        for (int i = 1; i <= t; i++) {
            Problem problem = new Problem();
            problem.solve(i);
        }
    }
}

class Problem {
    private static final Parser parser = Parser.getInstance();
    private static final Printer printer = Printer.getInstance();

    public void solve() {
    }

    public void solve(int testNum) {
        long x = parser.parseInt();
        long y = parser.parseInt();

        long ans = 0;

        for(int c = 1; c <= y; c++) {
            if(c * (y + 1) <= x) {
                ans += (y - c);
            } else {
                long l = c;
                long r = y + 1;
                while(l + 1 < r) {
                    long m = (l + r) / 2;
                    if(c * (m + 1) <= x) l = m;
                    else r = m;
                }
                long v = Math.max(0, (l - c));
                if(v == 0) {
                    break;
                } else {
                    ans += v;
                }
            }
        }
        System.out.println(ans);
    }
}

class SegmentTree {
    private final int size;
    private final long[] data;
    private final long[] lazy;
    private final BiFunction<Long, Long, Long> updateFunction;

    public SegmentTree(long[] array, BiFunction<Long, Long, Long> updateFunction) {
        size = array.length;
        data = new long[size * 4];
        lazy = new long[size * 4];
        this.updateFunction = updateFunction;
        init(array, 1, 0, size - 1);
    }

    private long init(long[] array, int node, int start, int end) {
        if (start == end) {
            return data[node] = array[start];
        }
        int mid = (start + end) / 2;
        return data[node] = updateFunction.apply(init(array, node * 2, start, mid), init(array, node * 2 + 1, mid + 1, end));
    }

    public void updateRange(int l, int r, long diff) {
        updateRange(1, 0, size - 1, l, r, diff);
    }

    private void updateRange(int node, int start, int end, int l, int r, long diff) {
        propagation(node, start, end);
        if (isOutOfRange(start, end, l, r)) return;
        if (isAllIn(start, end, l, r)) {
            lazy[node] += diff;
            propagation(node, start, end);
            return;
        }

        int mid = (start + end) / 2;
        updateRange(node * 2, start, mid, l, r, diff);
        updateRange(node * 2 + 1, mid + 1, end, l, r, diff);
        data[node] = updateFunction.apply(data[node * 2], data[node * 2 + 1]);
    }

    public long get(int l, int r) {
        return get(1, 0, size - 1, l, r);
    }

    private long get(int node, int start, int end, int l, int r) {
        propagation(node, start, end);
        if (isOutOfRange(start, end, l, r)) return 0;
        if (isAllIn(start, end, l, r)) return data[node];
        int mid = (start + end) / 2;
        return updateFunction.apply(get(node * 2, start, mid, l, r), get(node * 2 + 1, mid + 1, end, l, r));
    }

    private void propagation(int node, int start, int end) {
        long v = lazy[node];
        data[node] = updateFunction.apply(data[node], (end - start + 1) * v);
        if (start != end) {
            lazy[node * 2] += v;
            lazy[node * 2 + 1] += v;
        }
        lazy[node] = 0;
    }

    private boolean isOutOfRange(int start, int end, int l, int r) {
        return l > end || r <= start;
    }

    private boolean isAllIn(int start, int end, int l, int r) {
        return l <= start && end < r;
    }
}

class MathUtil {

    public static List<Integer> getPrimes(int r) {
        if (r < 2) {
            return new ArrayList<>();
        }

        List<Integer> result = new ArrayList<>();
        result.add(2);
        boolean[] is = new boolean[r + 1];
        for (int i = 4; i <= r; i += 2) {
            is[i] = true;
        }
        for (int i = 3; i <= r; i += 2) {
            if (is[i]) continue;
            result.add(i);
            for (long j = (long) i * i; j <= r; j += i) {
                is[(int) j] = true;
            }
        }
        return result;
    }

    public static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    public static long pow(long x, long y) {
        return pow(x, y, Function.identity());
    }

    public static long pow(long x, long y, long mod) {
        return pow(x, y, v -> v % mod);
    }

    private static long pow(long x, long y, Function<Long, Long> action) {
        long res = 1;
        long t = x;
        while (y > 0) {
            if ((y & 1) == 1) {
                res *= t;
                res = action.apply(res);
            }
            t *= t;
            t = action.apply(t);
            y /= 2;
        }
        return res;
    }
}

class DisjointSet {

    private final int[] f;
    private final int[] counts;
    private int size;

    public DisjointSet(int size) {
        this.size = size;
        this.f = new int[size];
        for (int i = 0; i < size; i++) {
            f[i] = i;
        }
        this.counts = new int[size];
        for (int i = 0; i < size; i++) {
            counts[i] = 1;
        }
    }

    public int find(int u) {
        if (f[u] == u) return u;
        return f[u] = find(f[u]);
    }

    public boolean merge(int u, int v) {
        u = find(u);
        v = find(v);
        if (u == v) return false;
        if (u > v) {
            int t = u;
            u = v;
            v = t;
        }
        f[u] = v;
        counts[v] += counts[u];
        return true;
    }

    public int getCounts(int v) {
        return counts[find(v)];
    }

    public void debug() {
        System.out.println(Arrays.toString(f));
    }
}

class IntPair {
    private int l;
    private int r;

    public IntPair(int l, int r) {
        this.l = l;
        this.r = r;
    }

    public int getL() {
        return l;
    }

    public void setL(int l) {
        this.l = l;
    }

    public int getR() {
        return r;
    }

    public void setR(int r) {
        this.r = r;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        IntPair pair = (IntPair) o;
        return l == pair.l &&
                r == pair.r;
    }

    @Override
    public int hashCode() {
        return Objects.hash(l, r);
    }
}

class Parser {
    private static final Parser PARSER = new Parser();
    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private StringTokenizer tokenizer;

    public int parseInt() {
        fill();
        return Integer.parseInt(tokenizer.nextToken());
    }

    public long parseLong() {
        fill();
        return java.lang.Long.parseLong(tokenizer.nextToken());
    }

    public double parseDouble() {
        fill();
        return Double.parseDouble(tokenizer.nextToken());
    }

    public String parseLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    String parseString() {
        fill();
        return tokenizer.nextToken();
    }

    private void fill() {
        while (tokenizer == null || !tokenizer.hasMoreElements()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static Parser getInstance() {
        return PARSER;
    }
}

class Printer {
    private static final Printer PRINTER = new Printer();
    private static final StringBuilder sb = new StringBuilder();

    public <T> Printer append(T o) {
        sb.append(o);
        return PRINTER;
    }

    public void print() {
        System.out.print(sb.toString());
        sb.setLength(0);
    }

    public static Printer getInstance() {
        return PRINTER;
    }
}