Let's divide 398857 by 40
Let's see how many times 40 fits into 398857.

Step 1:
3 divided by 40 is 0 with a remainder of 3.
Put 0 as the next digit of the answer. 
Result so far: 0.0
Subtract 0 from 3 to get 3.
Bring next digit (9) of the dividend behind the 3 and repeat the process: 39 / 40

Let's proceed to step 2:
If we divide 39 by 40, we get 0 and a remainder of 39.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
If we subtract 0 from 39, we get 39.
Include the next digit (8) from the dividend after 39, then repeat: 398 / 40

Advancing to step 3:
40 can be fit into 398 9 times, resulting in a remainder of 38.
Write down 9 as next digit of the result. 
Result so far: 9.0
The remainder is 38 after subtracting 360 from 398.
Bring next digit (8) of the dividend behind the 38 and repeat the process: 388 / 40

On to step 4:
40 can be fit into 388 9 times, resulting in a remainder of 28.
Record the quotient 9 as the next digit in the result. 
Result so far: 99.0
The remainder is 28 after subtracting 360 from 388.
Bring next digit (5) of the dividend behind the 28 and repeat the process: 285 / 40

Going ahead to step 5:
40 can be fit into 285 7 times, resulting in a remainder of 5.
Use 7 as the next digit of our solution. 
Result so far: 997.0
The remainder is 5 after subtracting 280 from 285.
Take the next digit (7) from the dividend and append it to 5, then repeat: 57 / 40

Going ahead to step 6:
When dividing 57 by 40, we get 1 with a remainder of 17.
Write down 1 as next digit of the result. 
Result so far: 9971.0
If we take 40 away from 57, we end up with 17.
Since there are no more digits in the dividend, we add a zero to the remainder making it 170, and continue the process.

Going ahead to step 7:
170 divided by 40 is 4 with a remainder of 10.
The next digit of our result is 4. 
Result so far: 9971.4
The remainder is 10 after subtracting 160 from 170.
Since there are no more digits in the dividend, we add a zero to the remainder making it 100, and continue the process.

On to step 8:
If we divide 100 by 40, we get 2 and a remainder of 20.
Record the quotient 2 as the next digit in the result. 
Result so far: 9971.42
Subtracting 80 from 100 leaves us 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.

Step 9:
If we divide 200 by 40, we get 5 and a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 9971.425
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.

Let's proceed to step 10:
The number 40 fits into 0 0 times, leaving a remainder of 0.
The number 0 becomes the next digit in our result. 
Result so far: 9971.425
If we take 0 away from 0, we end up 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.

Step 11:
0 divided by 40 is 0 with a remainder of 0.
The next digit of our result is 0. 
Result so far: 9971.425
Subtract 0 from 0 to 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.

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