New Year and Three Musketeers

CodeForces - 611E