MPMP 11 Age Puzzle Generalisation

The 11th Matt Parker's Maths Puzzle is the age puzzle. For more information, see here. This is a generalisation - for any set of values, however stil in the same format.