Given two non-negative integers n and r with 0 <= r <= n, return the binomial coefficient C(n, r) (the number of ways to choose r items from n items, with order ignored), taken modulo 10^9 + 7. By definition, C(n, 0) = C(n, n) = 1 for all n. Implement the calculation using the recursive identity C(n, r) = C(n-1, r-1) + C(n-1, r) (mod 10^9 + 7), with memoization.
Input: Two non-negative integers n and r separated by a comma, with 0 <= r <= n.
Output: Return an integer equal to C(n, r) mod (10^9 + 7).
Input: 5, 2
Output: 10
Explanation: C(5,2) = 10 ways to choose 2 from 5.Input: 6, 3
Output: 20
Explanation: C(6,3) = 20.Input: 10, 0
Output: 1
Explanation: Choosing zero items: 1 way.0 <= r <= n <= 1000