def fill_cell(sums, num, pos_x, pos_y):
    """
    Determine the value for the current cell by adding all values in
    the cells around it (value 0 if the cell is empty).  Also determine
    if the value is greater that the given number

    Returns a tuple of the value in the cell and if it was larger than
    the given number or not
    """

    newnum = sum(
        sums.get((pos_x + i, pos_y + j), 0)
        for i in [-1, 0, 1] for j in [-1, 0, 1]
    )

    sums[(pos_x, pos_y)] = newnum
    found = True if newnum > num else False

    return newnum, found