Given a floor of size n x m and tiles of size 1 x m. The problem is to count the number of ways to tile the given floor using 1 x m tiles. A tile can either be placed horizontally or vertically.

Both n and m are positive integers and 2 < = m.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains two integers M and N.

**Output:**

For each test case output the answer in a new line. As the number can be really large output the answer modulo **10 ^{9}+7**.

**Constraints:**

1<= T <=100

1<= N, M <=10000

**Example:**

**Input:**

2

2 3

4 4

**Output:**

1

2

Author: sujnesh

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.

makeitdonesolo | 64 |

ShubhamJain18 | 64 |

Bishnu Dev Panda | 54 |

DanishBansal | 50 |

abhithakur588 | 50 |

Bishnu Dev Panda | 777 |

yk12 | 512 |

okayboss | 490 |

DevMittal | 472 |

VijethaShastri | 431 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.