Given a number **X** and another number **Y **. There are a total **N** cycles , and alternatively we perform operation on each number . In each cycle , we multiply the number by 2 . Starting with **X** .

Suppose after all the **N** cycles, the number **X** has become **W** and number **Y** has become **Z **. You have to calculate the division of the maximum number among **W **and **Z** by the minimum number among **W** and** Z **.

**Input:**

The first line of the input contains an integer **T** denoting the number of test cases. The description of each testcase follows. Each test case contains a single line with 3 integers **X **, **Y **, and **N **.

**Output:**

For each test case output a new line with a single integer which should be the answer.

**Constraints:**

1 ≤ T ≤ 100

1 ≤ X ≤ 10^{7}

1 ≤ Y ≤ 10^{7}

1 ≤ N ≤ 10^{7}

**Example:
Input:**

2

1 2 1

3 2 3

1

3

In the first testcase ( only one cycle ), the initial numbers are (

In the second testcase, the initial numbers are **(X = 3, Y = 2) **. There three turns. In the first cycle X is multiplied by 2 . So, we get ( **X** = 6, **Y** = 2 ) . In the second cycle **Y ( Y = 2)** multiplies his number by 2. Hence, we get ( **X** = 6, ** Y** = 4 ) . In the third cycle **X ( X = 6) **is multiplied by 2. So, we get (**X** = 12, **Y** = 4) . As **N** = 3 , and we are completed with 3 cyles , therefore **W** = 12, and **Z** = 4 .

max ( **W **, **Z **) / min ( **W **, **Z **) = 12 / 4 = 3. Hence the second output is 3.

Author: diksha1812

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.

mantan_g | 267 |

tushki | 198 |

aksht7 | 182 |

ayush1101 | 128 |

namansharmacse17 | 110 |

ARUN_PUNDIR | 730 |

manishgupta8497 | 627 |

AMAN__JAIN | 625 |

Abhimanyu_kumar | 562 |

AJ786 | 541 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4584 |

Login to report an issue on this page.