A Rapid Sum

From Lewis Carroll’s diary, Feb. 5, 1856:

Varied the lesson at the school with a story, introducing a number of sums to be worked out. I also worked for them the puzzle of writing the answer to an addition sum, when only one of the five rows have been written: this … astonished them not a little.

He had started by writing an arbitrary number:

21879

Then he asked the students to call out a second five-digit number. Carroll added a third, the students shouted a fourth, and Carroll added a fifth and immediately wrote the sum:

  21879
  62593
  37406
  82527
+ 17472

 221877

How did he do this?

Click for Answer