program main implicit none integer*8::x,y,x2,y2 read *,x,y,x2,y2 if(x2.lt.x.and.y2.lt.y) then if(x2*y.eq.x*y2) then print '(i0)', MAX(x,y)+1 return end if endif print '(i0)', MAX(x,y) end program main