The first line of the input contains three integers![]()
--- The position of the matrix and the number of the segments.The size of the matrix and the number of the segments.
The next The nextlines each line contains three integers, and the
-th line belong to one of the following four types:
![]()
![]()
![]()
--- The length of the
-th segment is
and the coordinates of the endpoints are
and
.
![]()
![]()
![]()
--- The length of the
-th segment is
and the coordinates of the endpoints are
and
.
![]()
![]()
![]()
--- The length of the
-th segment is
and the coordinates of the endpoints are
and
.
![]()
![]()
![]()
--- The length of the
-th segment is
and the coordinates of the endpoints are
and
.
Print one integer — the number satisfying the conditions above.