Problem p00991 - Generation 3

Orig Description

Problem B: Grid
Given two coordinates (a1,a2) and (b1,b2) on a two-dimensional grid of size r × c, find the number of shortest paths from the first coordinate to the second coordinate. Moving from one cell to an adjacent cell (one step) costs one unit, and moving from cell (e,c-1) to cell (e,0), or from cell (r-1,f) to cell (0,f), also costs one unit.
Input
The input is given in the following format:
r c a1 a2 b1 b2
The input satisfies the following constraints:
1 ≤ r, c ≤ 1,000
0 ≤ a1, b1 < r
0 ≤ a2, b2 < c
Output
Output the number of shortest paths from the first coordinate to the second coordinate modulo 100,000,007.
Sample Input 1
4 4 0 0 3 3
Sample Output 1
2
Sample Input 2
4 4 0 0 1 1
Sample Output 2
2
Sample Input 3
2 3 0 0 1 2
Sample Output 3
4
Sample Input 4
500 500 0 0 200 200
Sample Output 4
34807775

Extracted Specification

An integer r (1 ≤ r ≤ 1,000), representing some quantity or size.
An integer c (1 ≤ c ≤ 1,000), representing some quantity or size.
An integer a1 (0 ≤ a1 < r), representing some quantity or size.
An integer a2 (0 ≤ a2 < c), representing some quantity or size.
An integer b1 (0 ≤ b1 < r), representing some quantity or size.
An integer b2 (0 ≤ b2 < c), representing some quantity or size.

### Example Input:

```
4 4 0 0 3 3
```

### Function Signature:
Write a function f(r, c, a1, a2, b1, b2) that takes in the input.
def f(r: int, c: int, a1: int, a2: int, b1: int, b2: int):
    '''
    r: an integer
    c: an integer
    a1: an integer
    a2: an integer
    b1: an integer
    b2: an integer
    '''

Test Case Generator

Certainly! For the given problem statement, you'll want to generate test cases that include random values for the grid size and coordinates, ensuring they fit within the specified constraints. Here's a test case generator for the problem "Grid":

```python
import random

def generate_test_case():
    # Generate random values for r and c within the specified range
    r = random.randint(1, 1000)
    c = random.randint(1, 1000)
    
    # Generate random values for the coordinates (a1, a2) and (b1, b2) within the grid
    a1 = random.randint(0, r-1)
    a2 = random.randint(0, c-1)
    b1 = random.randint(0, r-1)
    b2 = random.randint(0, c-1)
    
    return r, c, a1, a2, b1, b2

# Example usage:
test_case = generate_test_case()
print(test_case)
```

### Explanation:
1. **r and c**: Randomly generated integers between 1 and 1000, inclusive.
2. **a1 and b1**: Randomly generated integers between 0 and \( r-1 \), inclusive.
3. **a2 and b2**: Randomly generated integers between 0 and \( c-1 \), inclusive.

This generator ensures that the generated test cases adhere to the constraints specified in the problem statement. You can call `generate_test_case` multiple times to generate multiple test cases. Each call will produce a tuple containing the values for \( r \), \( c \), \( a1 \), \( a2 \), \( b1 \), and \( b2 \).

Extract Arguments

def extract_arguments(fh):
    r, c, a1, a2, b1, b2 = map(int, fh.readline().strip().split())
    return r, c, a1, a2, b1, b2