We look at the division of 5077 by 31 
We want to divide 5077 by 31.

Step 1:
31 goes into 5 0 times with a remainder of 5.
Use 0 as the next digit of our solution. 
Result so far: 0.0
Deduct 0 from 5 and we're left with 5.
Grab the next digit (0) from the dividend, add it to 5, then carry on: 50 / 31

Let's proceed to step 2:
50 divided by 31 is 1 with a remainder of 19.
Use 1 as the next digit of our solution. 
Result so far: 1.0
Subtracting 31 from 50 leaves us with 19.
Take the next digit (7) from the dividend and append it to 19, then repeat: 197 / 31

On to step 3:
If we divide 197 by 31, we get 6 and a remainder of 11.
Use 6 as the next digit of our solution. 
Result so far: 16.0
If we subtract 186 from 197, we get 11.
Include the next digit (7) from the dividend after 11, then repeat: 117 / 31

Let's proceed to step 4:
If we divide 117 by 31, we get 3 and a remainder of 24.
Record the quotient 3 as the next digit in the result. 
Result so far: 163.0
Deduct 93 from 117 and we're left with 24.
Since there are no more digits in the dividend, we add a zero to the remainder making it 240, and continue the process.

Moving on to step 5:
31 can be fit into 240 7 times, resulting in a remainder of 23.
Write down 7 as next digit of the result. 
Result so far: 163.7
The remainder is 23 after subtracting 217 from 240.
Since there are no more digits in the dividend, we add a zero to the remainder making it 230, and continue the process.

Going ahead to step 6:
If we divide 230 by 31, we get 7 and a remainder of 13.
Write down 7 as next digit of the result. 
Result so far: 163.77
The remainder is 13 after subtracting 217 from 230.
Since there are no more digits in the dividend, we add a zero to the remainder making it 130, and continue the process.

In conclusion, the division gives 163.77 with a balance of 0.013.