## DMOPC '19 Contest 1 P1 - Test Scores

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Veshy is suffering in AP Physics! He has a series of tests coming up and he has come up with four parameters describing each test:

• which indicates the number of problems on the -th test
• which indicates the number of points Veshy gets for one correct answer
• which indicates the number of points Veshy loses for an incorrect or unanswered question
• which indicates the score Veshy would like to earn on the -th test

For the -th test, output the minimum number of questions Veshy has to answer correctly in order to get at least marks. If Veshy's standards are too high and he cannot get marks on the -th test, then output -1.

In all tests,

#### Input Specification

The first line contains one integer, , the number of tests to follow.
The next lines contain four space-separated integers, .

#### Output Specification

Output lines. The -th line should contain one integer, the answer to the -th test.

#### Sample Input

5
1 4 2 5
9 2 6 4
2 9 3 5
3 5 2 10
8 2 5 7

#### Sample Output

-1
8
1
3
7