ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Алгоритмы и Структуры Данных > задача:


26. Exponentiation

Задачи сборника

• 44. Minimal Rotation
• 45. Static Range Sum Queries
• 01. Автобус в Джал
• 03. Новый язык программирования
• 05. Trailing Zeros
• 17. Number Spiral
• 23. Apple Division
• 25. Josephus Queries
• 26. Exponentiation
• 29. Coin Combinations I

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 4000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Сложность Бета

Your task is to efficiently calculate values ab modulo 109+7.
Note that in this task we assume that 00=1.

Input
The first input line contains an integer n : the number of calculations.
After this, there are n lines, each containing two integers a and b .
Output
Print each value ab modulo 109+7 .
Constraints
1≤n≤2⋅105
0≤a,b≤109

Example

Input:
3
3 4
2 8
123 123
Output:
81
256
921450052

Для отправки решений необходимо выполнить вход.

www.contester.ru