Given 4 integers a,b,c and k . Find the min(non-negative Integral) value of x such that ax^{2}+bx+c >= k.

**INPUT:**

The first line contains a single integer **T** i.e. the number of test cases. The first and the only line in each test case consists of four integers **a**,**b**,**c** and **k**.

**OUTPUT: **

Print the min value of the **x** so that the answer from the equation is atleast equal to k.

**CONSTRAINTS:**

1<=T<=100

1<= a,b,c <=10^{5}

1<=k<=10^{9}

**EXAMPLES:
INPUT:**

2

4 6 5 5

1 2 3 4

**OUTPUT:**

0

1

Author: saksham0751

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

RatneshTiwari3 | 24 |

AnmolPassi | 20 |

Swords | 20 |

baranwalsuraj96 | 17 |

tarun711 | 16 |

Bishnu Dev Panda | 727 |

yk12 | 512 |

DevMittal | 472 |

okayboss | 458 |

VijethaShastri | 431 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4921 |

Quandray | 4547 |

Login to report an issue on this page.