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.

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.