Hard, it is impossible to think exactly movement of a tree, all we need to do is know how many coin is useless/excess in current subtree, then report it to root and we are done. During that time, we calculate the total move.

Error:

  1. do not know what res store: it store the total move of its subtree
  2. do not know what return’s return: it return how many coin excess in current subtree