Source: https://cdn.eduncle.com/library/scoop-files/2017/01/Problems-on-Ages-Trains-Boats-Streams-Formulas-PDF.pdf