CF1183C Computer Game

Description

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

Input Format

The first line of the input contains one integer $ q $ ( $ 1 \le q \le 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 \le k, n \le 10^9, 1 \le b < a \le 10^9 $ ) — the initial charge of Vova's laptop battery, the number of turns in the game and values $ a $ and $ b $ , correspondingly.

Output Format

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

Explanation/Hint

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 notebook battery will be $ 0 $ after the last turn.