시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 150 0 0 0.000%

문제

숲 속 한 가운데 커다란 고목나무가 한 그루 있다. 다람이는 그 고목의 나무 구멍 속에 살고 있는데, 다람이는 매일매일 아주 독특한 방법으로 숲속을 산책한다. 다람이는 북쪽을 바라본채로 고목을 떠나서 걷기 시작하고, 매초마다 아래의 행동을 취한다:

  • 만약 그녀 발 아래 땅콩이 있다면, 그 땅콩을 줍고 오른쪽으로 90도 돌아 다시 1m를 전진한다.
  • 만약 그녀 발 아래 땅콩이 없다면, 땅콩 1개를 그 자리에 내려 놓고는, 왼쪽으로 90도 돌아 다시 1m 전진한다.

다람이는 속도가 매우 빨라서 매초마다 1m씩 전진하고, 힘도 아주 세서 땅콩도 항상 모자르지 않게 들고다닌다. t초 뒤에 땅에 놓여있는 땅콩의 개수를 구하라.

입력

첫째 줄에는 다람이가 고목을 떠난 순간에(0초) 땅에 놓인 땅콩의 개수 n(0 ≤ n ≤ 7)이 주어진다.

그 다음 n줄에는 각 줄마다 땅콩의 위치가 좌표로 주어진다. 좌표는 x, y(-2 ≤ x,y ≤ 2) 순으로 두개의 정수가 주어진다. (주어진 땅콩의 위치는 동쪽으로 x미터, 남쪽으로 y미터이다.) 각 좌표에는 한개의 땅콩만 놓여있다.

마지막 줄에는 다람이가 몇 초간 산책하는지인 정수 t(0 ≤ t ≤ 109)가 주어진다.                                                                                          

출력

첫 째줄에 t초 후 땅에 놓인 땅콩의 개수를 출력하라.

예제 입력 1

2
0 0
-2 1
8

예제 출력 1

6
W3sicHJvYmxlbV9pZCI6Ijg1MzYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWI1NDVcdWNmNjlcdWM3NTggXHVhYzFjXHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWMyMzIgXHVjMThkIFx1ZDU1YyBcdWFjMDBcdWM2YjRcdWIzNzAgXHVjZWU0XHViMmU0XHViNzgwIFx1YWNlMFx1YmFhOVx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