Math can't be written tomorrow.
Suppose that B transfers X tons of water to A, then B transfers 14-x tons to B, A transfers 15-x tons to A, and A transfers 14-( 15-x) tons to B, and then multiplies the transferred tonnage by the corresponding distance, and it becomes the demand. Think for yourself.