rule for crossing left and right border