We look at the division of 40087168 by 789 
Our goal is to divide 40087168 by 789.

On to step 1:
The number 789 fits into 4 0 times, leaving a remainder of 4.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
Subtract 0 from 4 to get 4.
Fetch the next digit (0) from the dividend, attach it to 4 and continue: 40 / 789

On to step 2:
789 goes into 40 0 times with a remainder of 40.
Use 0 as the next digit of our solution. 
Result so far: 0.0
Deduct 0 from 40 and we're left with 40.
Include the next digit (0) from the dividend after 40, then repeat: 400 / 789

Going ahead to step 3:
400 divided by 789 is 0 with a remainder of 400.
The next digit of our result is 0. 
Result so far: 0.0
Deduct 0 from 400 and we're left with 400.
Take the next digit (8) from the dividend and append it to 400, then repeat: 4008 / 789

Advancing to step 4:
789 goes into 4008 5 times with a remainder of 63.
The number 5 becomes the next digit in our result. 
Result so far: 5.0
If we take 3945 away from 4008, we end up with 63.
Grab the next digit (7) from the dividend, add it to 63, then carry on: 637 / 789

Step 5:
When dividing 637 by 789, we get 0 with a remainder of 637.
Record the quotient 0 as the next digit in the result. 
Result so far: 50.0
Deduct 0 from 637 and we're left with 637.
Bring next digit (1) of the dividend behind the 637 and repeat the process: 6371 / 789

Advancing to step 6:
6371 divided by 789 is 8 with a remainder of 59.
Use 8 as the next digit of our solution. 
Result so far: 508.0
If we take 6312 away from 6371, we end up with 59.
Append the next digit (6) from the dividend to 59 and continue with: 596 / 789

Advancing to step 7:
When dividing 596 by 789, we get 0 with a remainder of 596.
Write down 0 as next digit of the result. 
Result so far: 5080.0
The remainder is 596 after subtracting 0 from 596.
Bring next digit (8) of the dividend behind the 596 and repeat the process: 5968 / 789

Let's proceed to step 8:
789 goes into 5968 7 times with a remainder of 445.
The next digit of our result is 7. 
Result so far: 50807.0
The remainder is 445 after subtracting 5523 from 5968.
Since there are no more digits in the dividend, we add a zero to the remainder making it 4450, and continue the process.

Step 9:
If we divide 4450 by 789, we get 5 and a remainder of 505.
Write down 5 as next digit of the result. 
Result so far: 50807.5
If we take 3945 away from 4450, we end up with 505.
Since there are no more digits in the dividend, we add a zero to the remainder making it 5050, and continue the process.

Let's proceed to step 10:
5050 divided by 789 is 6 with a remainder of 316.
Put 6 as the next digit of the answer. 
Result so far: 50807.56
The remainder is 316 after subtracting 4734 from 5050.
Since there are no more digits in the dividend, we add a zero to the remainder making it 3160, and continue the process.

Advancing to step 11:
If we divide 3160 by 789, we get 4 and a remainder of 4.
Write down 4 as next digit of the result. 
Result so far: 50807.564
The remainder is 4 after subtracting 3156 from 3160.
Since there are no more digits in the dividend, we add a zero to the remainder making it 40, and continue the process.

Going ahead to step 12:
If we divide 40 by 789, we get 0 and a remainder of 40.
The number 0 becomes the next digit in our result. 
Result so far: 50807.564
Subtract 0 from 40 to get 40.
Since there are no more digits in the dividend, we add a zero to the remainder making it 400, and continue the process.

Let's proceed to step 13:
If we divide 400 by 789, we get 0 and a remainder of 400.
The next digit of our result is 0. 
Result so far: 50807.564
If we subtract 0 from 400, we get 400.
Since there are no more digits in the dividend, we add a zero to the remainder making it 4000, and continue the process.

The final outcome is 50807.564, with a leftover of 0.0004.