• + 0 comments
    MOD = 10**9 + 7
    
    def mod_expo(base, exponent, modulus):
        result = 1
        base = base % modulus
        while exponent > 0:
            if exponent % 2 == 1:
               result = (result * base) % modulus
            exponent = exponent >> 1
            base = (base * base) % modulus
        return result
    
    T = int(input().strip())
    for _ in range(T):
        A, B = map(int, input().split())
        print(mod_expo(A, B, MOD))
    

    https://retrobowlcollege.com/