

def       snake_case__    (       lowerCAmelCase_,   lowerCAmelCase_,   lowerCAmelCase_      ):





     """simple docstring"""







     assert b != 0, "This cannot accept modulo that is == 0"
     if n == 0:
          return 1

     if n % 2 == 1:
          return (bin_exp_mod(lowerCAmelCase_,   n - 1,   lowerCAmelCase_      ) * a) % b

     SCREAMING_SNAKE_CASE										=bin_exp_mod(lowerCAmelCase_,   n / 2,   lowerCAmelCase_      )
     return (r * r) % b


if __name__ == "__main__":
 try:
  _lowerCamelCase								=int(input("Enter Base : ").strip())
  _lowerCamelCase								=int(input("Enter Power : ").strip())
  _lowerCamelCase								=int(input("Enter Modulo : ").strip())
 except ValueError:
  print("Invalid literal for integer")

 print(bin_exp_mod(BASE, POWER, MODULO))




def       snake_case__    (       lowerCAmelCase_,   lowerCAmelCase_,   lowerCAmelCase_      ):





     """simple docstring"""







     if power < 0:
          return -1
     base %= mod
     SCREAMING_SNAKE_CASE										=1

     while power > 0:
          if power & 1:
               SCREAMING_SNAKE_CASE										=(result * base) % mod
          SCREAMING_SNAKE_CASE										=power >> 1
          SCREAMING_SNAKE_CASE										=(base * base) % mod

     return result







def       snake_case__    (       ):





     """simple docstring"""







     print(modular_exponential(3,   200,   13      )      )


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 main()

