def count_trees_hit(grid, slope):
    """ Counts the trees that were hit on the way down

    :param grid: the map
    :param slope: [n_rows, n_columns] determines the next position after each iteration
    :return: int
    """
    # [row, column]
    coords = [0, 0]
    counter = 0

    # repeat until bottom is reached
    while coords[0] < len(grid):
        # if landed on a tree increment counter
        if grid[coords[0]][coords[1]] == '#':
            counter += 1
        # update position
        coords = [coords[0] + slope[0], (coords[1] + slope[1]) % len(grid[0])]

    return counter