Valera get n domino piece row each piece consist half upper lower each half contain number 1 6 Valera love integer want sum number upper half sum number low half evento Valera rotate dominoe 180 degree after rotation upper low half swap place this action take second help Valera find minimum time spend rotate domino wish come true