From 1812 identical squares with a side length of 1 mm, a rectangular frame was made for a group photo. The boundaries of the photo coincide with the inner boundaries of the frame. Then the photo was cut along the millimeter grid line into two rectangular parts. Now, two frames were needed, which used up 2018 of the same squares. Find the dimensions of the original photo.