It's like the old bank account update problem you learn at university :-)