3-Sum and rotate image