import math


def closed_form_solution(grid_size: int) -> int:
    """Closed form solution for number of routes through a `grid_size`x`grid_size`grid.
    Using binomial coefficents in Pascal's triangle.
    """
    return math.factorial(2 * grid_size) // math.factorial(grid_size)**2