eolymp
bolt
Try our new interface for solving problems
Problems

Modular division

published at 5/19/20, 11:37:22 am

Salamun Eleykum

published at 5/19/20, 11:38:06 am

ekeykim

published at 5/17/21, 2:20:28 pm

Salam

published at 2/4/23, 8:15:22 pm

Salam)

published at 9/6/23, 12:20:15 pm

 

def binpow(x, y, p):
    ans = 1
    while y:
        if y % 2 != 0:
            ans = ans * x % p
        y //= 2
        x = x * x % p
    return ans

a, b, n = map(int, input().split())
print(a * binpow(b, n - 2, n) % n)