Greater power
Submissions: 434   Accuracy:

15.16%

  Difficulty: Easy   Marks: 2

Given four integers a,b,m,n . Find whether  pow(a,b) is greater than pow(m,n) or not. Where pow(x,y) denotes x raised to the power y.
 

Input

First line of input contains of an integer 'T 'denoting number of test cases .Only line of each testcase contains four integers a,b,m and n  .

 

Output

For each case in a new line print 1 if pow(a,b) is greater , print 0 if pow(m,n) is greater else print -1 if both are equal.
 

Constraints

1<=T<=100

0<=b,n<=10^18

1<=a,m<=10^18


Example

Input

2

2 2 3 2

1 23 1 34

 

Output

0

-1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Hardik Gulati
Author: hardikgulati96


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.