```python
def ncr_modp(n, r, p):
    """
    Computes the value of nCr % p.
    This implementation uses Lucas's Theorem to handle large n and r.
    It assumes that p is a prime number.
    """

    # Helper function for modular exponentiation (power function)
    # Computes (a^b) % p
    def power(a, b):
        res = 1
        a %= p
        while b > 0:
            if b % 2 == 1:
                res = (res * a) % p
            a = (a * a) % p
            b //= 2
        return res

    # Helper function to compute modular multiplicative inverse
    # Computes (n^-1) % p using Fermat's Little Theorem
    def modInverse(n):
        return power(n, p - 2)

    # Helper function to compute nCr % p for n < p
    def ncr_modp_small(n_small, r_small):
        if r_small < 0 or r_small > n_small:
            return 0
        if r_small == 0 or r_small == n_small:
            return 1
        # Use the identity C(n, r) = C(n, n-r)
        if r_small > n_small // 2:
            r_small = n_small - r_small
        
        numerator = 1
        for i in range(r_small):
            numerator = (numerator * (n_small - i)) % p
            
        denominator = 1
        for i in range(1, r_small + 1):
            denominator = (denominator * i) % p
            
        return (numerator * modInverse(denominator)) % p

    # Handle base cases
    if r < 0 or r > n:
        return 0

    # Apply Lucas's Theorem
    res = 1
    while n > 0:
        ni = n % p
        ri = r % p
        
        term = ncr_modp_small(ni, ri)
        
        if term == 0:
            return 0
        
        res = (res * term) % p
        
        n //= p
        r //= p
        
    return res
```