시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 111 52 44 46.809%

문제

진수는 동생 지수로부터 크기가  n × m인 마법의 체스판을 받았다. 마법의 체스판은 신기한 기능이 많이 있는데 그중에는 체스판의 색상을 반전시킬 수 있는 기능이 있다. 이 기능을 사용하면 칸들을 포함하는 직사각형을 선택하여 하얀색은 검은색으로 검은색은 하얀색으로 바꿀 수 있다.

초기에는 칸들의 색상이 일반적인 체스판처럼 칠해져 있다. 다르게 말하면 변을 공유하는 칸들은 서로 색상이 다르다. 진수는 위에서 설명한 기능을 최소한으로 이용하여 모든 칸의 색상을 같게 하고 싶다. 하지만 아무리 고민해도 방법을 찾지 못하였다. 그래서 진수는 당신에게 이 문제를 풀어 달라고 요청했다.

입력

첫 번째 줄에 행과 열의 개수를 나타내는 두 개의 정수 n과 m이 주어진다.  (1 ≤ n, m ≤ 50)

출력

첫 번째 줄에는 반전 횟수 k를 출력한다.

다음 k개 줄에는 줄 마다 직사각형의 모서리를 포함하는 좌표와 마주보는 모서리의 좌표를 출력한다. 

행은 1번부터 n번까지 있으며 열은 1부터 m번까지 있다.

예제 입력 1

2 2

예제 출력 1

2
1 1 1 1
2 2 2 2
W3sicHJvYmxlbV9pZCI6IjEwNTg5IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHViOWM4XHViYzk1XHVjNzU4IFx1Y2NiNFx1YzJhNFx1ZDMxMCIsImRlc2NyaXB0aW9uIjoiPHA+XHVjOWM0XHVjMjE4XHViMjk0IFx1YjNkOVx1YzBkZCBcdWM5YzBcdWMyMThcdWI4NWNcdWJkODBcdWQxMzAgXHVkMDZjXHVhZTMwXHVhYzAwICZuYnNwO24gJnRpbWVzOyBtXHVjNzc4IFx1YjljOFx1YmM5NVx1Yzc1OCBcdWNjYjRcdWMyYTRcdWQzMTBcdWM3NDQgXHViYzFiXHVjNTU4XHViMmU0LiBcdWI5YzhcdWJjOTVcdWM3NTggXHVjY2I0XHVjMmE0XHVkM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