40978718 divided by 791 
Let's see how many times 791 fits into 40978718.

Moving on to step 1:
When dividing 4 by 791, we get 0 with a remainder of 4.
The next digit of our result is 0. 
Result so far: 0.0
If we take 0 away from 4, we end up with 4.
Take the next digit (0) from the dividend and append it to 4, then repeat: 40 / 791

Going ahead to step 2:
When dividing 40 by 791, we get 0 with a remainder of 40.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
If we take 0 away from 40, we end up with 40.
Grab the next digit (9) from the dividend, add it to 40, then carry on: 409 / 791

Going ahead to step 3:
The number 791 fits into 409 0 times, leaving a remainder of 409.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
The remainder is 409 after subtracting 0 from 409.
Bring next digit (7) of the dividend behind the 409 and repeat the process: 4097 / 791

Advancing to step 4:
When dividing 4097 by 791, we get 5 with a remainder of 142.
Put 5 as the next digit of the answer. 
Result so far: 5.0
Deduct 3955 from 4097 and we're left with 142.
Append the next digit (8) from the dividend to 142 and continue with: 1428 / 791

Moving on to step 5:
When dividing 1428 by 791, we get 1 with a remainder of 637.
The number 1 becomes the next digit in our result. 
Result so far: 51.0
If we take 791 away from 1428, we end up with 637.
Bring next digit (7) of the dividend behind the 637 and repeat the process: 6377 / 791

Step 6:
When dividing 6377 by 791, we get 8 with a remainder of 49.
Record the quotient 8 as the next digit in the result. 
Result so far: 518.0
Deduct 6328 from 6377 and we're left with 49.
Append the next digit (1) from the dividend to 49 and continue with: 491 / 791

On to step 7:
The number 791 fits into 491 0 times, leaving a remainder of 491.
Write down 0 as next digit of the result. 
Result so far: 5180.0
Subtract 0 from 491 to get 491.
Grab the next digit (8) from the dividend, add it to 491, then carry on: 4918 / 791

Step 8:
When dividing 4918 by 791, we get 6 with a remainder of 172.
Record the quotient 6 as the next digit in the result. 
Result so far: 51806.0
Deduct 4746 from 4918 and we're left with 172.
Since there are no more digits in the dividend, we add a zero to the remainder making it 1720, and continue the process.

Moving on to step 9:
791 goes into 1720 2 times with a remainder of 138.
Write down 2 as next digit of the result. 
Result so far: 51806.2
If we subtract 1582 from 1720, we get 138.
Since there are no more digits in the dividend, we add a zero to the remainder making it 1380, and continue the process.

On to step 10:
If we divide 1380 by 791, we get 1 and a remainder of 589.
Write down 1 as next digit of the result. 
Result so far: 51806.21
Deduct 791 from 1380 and we're left with 589.
Since there are no more digits in the dividend, we add a zero to the remainder making it 5890, and continue the process.

Moving on to step 11:
5890 divided by 791 is 7 with a remainder of 353.
Record the quotient 7 as the next digit in the result. 
Result so far: 51806.217
If we subtract 5537 from 5890, we get 353.
Since there are no more digits in the dividend, we add a zero to the remainder making it 3530, and continue the process.

On to step 12:
The number 791 fits into 3530 4 times, leaving a remainder of 366.
The number 4 becomes the next digit in our result. 
Result so far: 51806.2174
If we take 3164 away from 3530, we end up with 366.
Since there are no more digits in the dividend, we add a zero to the remainder making it 3660, and continue the process.

Going ahead to step 13:
The number 791 fits into 3660 4 times, leaving a remainder of 496.
Put 4 as the next digit of the answer. 
Result so far: 51806.21744
If we subtract 3164 from 3660, we get 496.
Since there are no more digits in the dividend, we add a zero to the remainder making it 4960, and continue the process.

In conclusion, the division gives 51806.21744 with a balance of 0.000496.