Let's divide 864987 by 40
Our goal is to divide 864987 by 40.

Going ahead to step 1:
When dividing 8 by 40, we get 0 with a remainder of 8.
The next digit of our result is 0. 
Result so far: 0.0
Subtracting 0 from 8 leaves us with 8.
Grab the next digit (6) from the dividend, add it to 8, then carry on: 86 / 40

Going ahead to step 2:
If we divide 86 by 40, we get 2 and a remainder of 6.
Use 2 as the next digit of our solution. 
Result so far: 2.0
Deduct 80 from 86 and we're left with 6.
Fetch the next digit (4) from the dividend, attach it to 6 and continue: 64 / 40

Step 3:
If we divide 64 by 40, we get 1 and a remainder of 24.
Use 1 as the next digit of our solution. 
Result so far: 21.0
The remainder is 24 after subtracting 40 from 64.
Bring next digit (9) of the dividend behind the 24 and repeat the process: 249 / 40

Step 4:
40 can be fit into 249 6 times, resulting in a remainder of 9.
Record the quotient 6 as the next digit in the result. 
Result so far: 216.0
Deduct 240 from 249 and we're left with 9.
Include the next digit (8) from the dividend after 9, then repeat: 98 / 40

Step 5:
The number 40 fits into 98 2 times, leaving a remainder of 18.
Write down 2 as next digit of the result. 
Result so far: 2162.0
Subtracting 80 from 98 leaves us with 18.
Take the next digit (7) from the dividend and append it to 18, then repeat: 187 / 40

Step 6:
187 divided by 40 is 4 with a remainder of 27.
Put 4 as the next digit of the answer. 
Result so far: 21624.0
The remainder is 27 after subtracting 160 from 187.
Since there are no more digits in the dividend, we add a zero to the remainder making it 270, and continue the process.

Step 7:
If we divide 270 by 40, we get 6 and a remainder of 30.
The next digit of our result is 6. 
Result so far: 21624.6
Subtract 240 from 270 to get 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Let's proceed to step 8:
300 divided by 40 is 7 with a remainder of 20.
Use 7 as the next digit of our solution. 
Result so far: 21624.67
Deduct 280 from 300 and we're left with 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Let's proceed to step 9:
The number 40 fits into 200 5 times, leaving a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 21624.675
Deduct 200 from 200 and we're left with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Advancing to step 10:
If we divide 0 by 40, we get 0 and a remainder of 0.
Put 0 as the next digit of the answer. 
Result so far: 21624.675
If we subtract 0 from 0, we get 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Advancing to step 11:
40 goes into 0 0 times with a remainder of 0.
Use 0 as the next digit of our solution. 
Result so far: 21624.675
Subtracting 0 from 0 leaves us with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

In conclusion, the division gives 21624.675 with a balance of 0.0.