def multiplication_egyptienne(n: int, m: int) -> int:
    assert n>=1 and m>=1
    result = m
    if n > 1:
        if n % 2 == 0:
            result = multiplication_egyptienne(n//2, m*2)
        else:
            result = m + multiplication_egyptienne(n-1, m)
    return result

print(multiplication_egyptienne(7,5))

def multiplication_egyptienne2(n: int, m: int) -> int:
    assert n>=1 and m>=1
    if n == 1:
        return m
    elif n % 2 == 0:
        return multiplication_egyptienne(n//2, m*2)
    else:
         return m + multiplication_egyptienne(n-1, m)

print(multiplication_egyptienne2(7,5))

def multiplication_egyptienne_iterative(n: int, m: int) -> int:
    assert n > m
    assert n>=1 and m>=1
    result = 0
    while n > 1:
        if n % 2 != 0:
            result += m
            n = n-1
        else :
            n = n//2
            m = m*2
    result += m
    return result

print(multiplication_egyptienne_iterative(7,5))
