def get_grid_value(grid, row, col, size):
    """Get value of grid, starting from (row, col) and with size."""
    return sum(
        sum(cur_row[col:col + size])
        for cur_row in grid[row: row + size]
    )