Given a fence with n posts and k colors, find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color. Since answer can be large return it modulo 10^9 + 7.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Each test case contains two integers n and k.

**Output:**

Print an integer which denoted the number of ways in which the fence can be painted.(modulo 10^{9} + 7)

**Constraints:**

1<=T<=1000

1<=n<=100000

1<=k<=100

**Example:
Input:**

2

2 4

3 2

**Output:**

16

6

For the second test case we have following possible combinations:

Ibrahim Nash | 77 |

Stark_Maverick | 68 |

wmlam | 54 |

Lam Ngoc Pham | 50 |

Micky_Kt | 48 |

Lam Ngoc Pham | 455 |

All Is Well | 399 |

Divvya Sinha | 374 |

Prateek Gole | 363 |

ioan | 319 |

akhayrutdinov | 3855 |

sanjay05 | 3366 |

Michael Riegger | 2023 |

Jasleen Kaur 2 | 2012 |

Quandray | 1965 |