def pow_mod(x: int, y: int, z: int) ->int:
    """
    int, int, int (or float)
    returns (x^y)mod z
    """
    number = 1
    while y:
        if y & 1:
            number = number * x % z
        y >>= 1
        x = x * x % z
    return number
