Solve SRM 144, Div 2, Problem ImageDithering