You are given a rectangular grid of wells. Each row represents a single well,
    and each 1 in a row represents a single unit of water.
    Each well has a corresponding bucket that can be used to extract water from it, 
    and all buckets have the same capacity.
    Your task is to use the buckets to empty the wells.
    Output the number of times you need to lower the buckets.

Please write a Python function to do that, taking in input the grid and the capacity of the buckets. Give two different versions of responses. Please separate the responses with 6 asterisk symbols: ******.
user