Write a function that calculates a^b % c.
Implement modular_power(a, b, c), where a and b are integers, b is non-negative, and c is a positive integer. Return the integer remainder (a^b) % c without constructing the full value of a^b; use an algorithm efficient for very large exponents.
Examples: modular_power(2, 10, 1000) returns 24, and modular_power(3, 0, 5) returns 1. Assume c > 0.
def modular_power(a, b, c):