Vova is playing a computer game. There are in total n turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is k.

During each turn Vova can choose what to do: 

  * If the current charge of his laptop battery is strictly greater than a, Vova can just play, and then the charge of his laptop battery will decrease by a; 
  * if the current charge of his laptop battery is strictly greater than b (b<a), Vova can play and charge his laptop, and then the charge of his laptop battery will decrease by b; 
  * if the current charge of his laptop battery is less than or equal to a and b at the same time then Vova cannot do anything and loses the game. 



Regardless of Vova's turns the charge of the laptop battery is always decreases.

Vova wants to complete the game (Vova can complete the game if after each of n turns the charge of the laptop battery is strictly greater than 0). Vova has to play exactly n turns. Among all possible ways to complete the game, Vova wants to choose the one where the number of turns when he just plays (first type turn) is the maximum possible. It is possible that Vova cannot complete the game at all.

Your task is to find out the maximum possible number of turns Vova can just play (make the first type turn) or report that Vova cannot complete the game.

You have to answer q independent queries.

Input

The first line of the input contains one integer q (1 ≤ q ≤ 10^5) — the number of queries. Each query is presented by a single line.

The only line of the query contains four integers k, n, a and b (1 ≤ k, n ≤ 10^9, 1 ≤ b < a ≤ 10^9) — the initial charge of Vova's laptop battery, the number of turns in the game and values a and b, correspondingly.

Output

For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.

Example

Input


6
15 5 3 2
15 5 4 3
15 5 2 1
15 5 5 1
16 7 5 2
20 5 7 3


Output


4
-1
5
2
0
1

Note

In the first example query Vova can just play 4 turns and spend 12 units of charge and then one turn play and charge and spend 2 more units. So the remaining charge of the battery will be 1.

In the second example query Vova cannot complete the game because even if he will play and charge the battery during each turn then the charge of the laptop battery will be 0 after the last turn.
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Codeforces {

    static double Phi = (1 + Math.sqrt(5)) / 2.0;
    static int MAX = -1 >>> 1;
    static long MODL = 1_000_000_007L;
    static int MOD = 1_000_000_007;
    static void no() throws IOException {println("NO");}
    static void yes() throws IOException {println("YES");}

    static boolean testCases = true;
    static boolean DEBUG = true;

    static void main() throws Exception {
        long k = nl();
        long n = nl();
        long a = nl();
        long b = nl();
        if(k <= b) {
            println(-1);
            return;
        }
        long lo = 0;
        long hi = n;
        long ans = -1;
        while(lo <= hi) {
            long mid = lo + (hi - lo >> 1);
            //use mid for a and n - mid for b
            if(check(k, n, mid, a, b)) {
                ans = Math.max(ans, mid);
                lo = mid + 1;
            } else {
                hi = mid - 1;
            }
        }
        println(ans);
    }
    static boolean check(long k, long n, long mid, long a, long b) {
        //use mid
        if(k - (mid - 1) * a >= a) {
            //valid mid value
            k -= mid * a;
            if(k - (n - mid) * b > 0) {
                return true;
            }
        }
        return false;
    }
    
    public static void main(String[] args) throws Exception {
        long startPointTime = System.currentTimeMillis();
        scannerIn = System.in;
        printerBW = new BufferedWriter(new OutputStreamWriter(System.out));
        if (DEBUG && System.getProperty("ONLINE_JUDGE") == null) {
            HABLA = true;
            debug("Debugging enabled");
        }

        int t = testCases ? ni() : 1;
        int to = t;
        while (t-- > 0) {
            debug("Case #" + (to - t) + " ---------------- ");
            main();
        }
        long endTime = System.currentTimeMillis();
        float totalProgramTime = endTime - startPointTime;
        if (HABLA)
            debug("Execution time is " + totalProgramTime + " (" + (totalProgramTime / 1000) + "s)");
        close();
    }
    
 //IO Stuff
    private static boolean HABLA = false;
    private static byte[] scannerByteBuffer = new byte[1024]; // Buffer of Bytes
    private static int scannerIndex;
    private static InputStream scannerIn;
    private static int scannerTotal;
    private static BufferedWriter printerBW;

    private static int next() throws IOException { // Scan method used to scan buf
        if (scannerTotal < 0)
            throw new InputMismatchException();
        if (scannerIndex >= scannerTotal) {
            scannerIndex = 0;
            scannerTotal = scannerIn.read(scannerByteBuffer);
            if (scannerTotal <= 0)
                return -1;
        }
        return scannerByteBuffer[scannerIndex++];
    }

    static int ni() throws IOException {
        int integer = 0;
        int n = next();
        while (isWhiteSpace(n)) // Removing startPointing whitespaces
            n = next();
        int neg = 1;
        if (n == '-') { // If Negative Sign encounters
            neg = -1;
            n = next();
        }
        while (!isWhiteSpace(n)) {
            if (n >= '0' && n <= '9') {
                integer *= 10;
                integer += n - '0';
                n = next();
            } else
                throw new InputMismatchException();
        }
        return neg * integer;
    }

    static long nl() throws IOException {
        long integer = 0;
        int n = next();
        while (isWhiteSpace(n)) // Removing startPointing whitespaces
            n = next();
        int neg = 1;
        if (n == '-') { // If Negative Sign encounters
            neg = -1;
            n = next();
        }
        while (!isWhiteSpace(n)) {
            if (n >= '0' && n <= '9') {
                integer *= 10;
                integer += n - '0';
                n = next();
            } else
                throw new InputMismatchException();
        }
        return neg * integer;
    }

    static String line() throws IOException {
        StringBuilder sb = new StringBuilder();
        int n = next();
        while (isWhiteSpace(n))
            n = next();
        while (!isNewLine(n)) {
            sb.append((char) n);
            n = next();
        }
        return sb.toString();
    }

    private static boolean isNewLine(int n) {
        return n == '\n' || n == '\r' || n == -1;
    }

    private static boolean isWhiteSpace(int n) {
        return n == ' ' || isNewLine(n) || n == '\t';
    }

    static int[] nia(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = ni();
        return array;
    }

    static long[] nla(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static float[] nfa(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        float[] array = new float[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static double[] nda(int n) throws Exception {
        if (n < 0)
            throw new Exception("Array size should be non negative");
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nl();
        return array;
    }

    static <T> void print(T str) throws IOException {
        printerBW.append(str.toString());
        if (HABLA) flush();
    }

    static <T> void println() throws IOException {
        printerBW.append('\n');
        if (HABLA) flush();
    }

    static <T> void println(T str) throws IOException {
        if (str == null) {
            printerBW.append("null\n");
        } else {
            printerBW.append(str.toString());
            printerBW.append('\n');
            if (HABLA) flush();
        }
    }

    public static final String ANSI_RESET = "\u001B[0m";
    public static final String ANSI_DEBUG = "\u001B[33m";
    static <T> void debugl(T str) throws IOException {
        if (!HABLA) return;
        if (str == null) {
            printerBW.append(ANSI_DEBUG);
            printerBW.append("null");
            printerBW.append(ANSI_RESET);
        } else {
            printerBW.append(ANSI_DEBUG);
            printerBW.append(str.toString());
            printerBW.append(ANSI_RESET);
        }
        flush();
    }

    static void debug() throws IOException {
        if (!HABLA) return;
        printerBW.append('\n');
        flush();
    }
    static <T> void debug(T str) throws IOException {
        if (!HABLA) return;
        if (str == null) {
            printerBW.append(ANSI_DEBUG);
            printerBW.append("null\n");
            printerBW.append(ANSI_RESET);
        } else {
            printerBW.append(ANSI_DEBUG);
            printerBW.append(str.toString());
            printerBW.append(ANSI_RESET);
            printerBW.append('\n');
        }
        flush();
    }

    static void flush() throws IOException {
        printerBW.flush();
    }

    static void close() {
        try {
            printerBW.close();
        } catch (IOException e) {
            System.out.println(e.toString());
        }
    }
}
