#include #include using namespace std; vector> map{ { 0, 2, 0, 0, 0, 2 },{ 0, 0, 2, 0, 1, 0 },{ 1, 0, 0, 2, 2, 0 } }; enum Direction { NONE, RIGHT, DOWN }; int result(int m, int n, int x, int y, Direction direction) { if (x >= m || y >= n) return 0; int answer = 0; if (x == m - 1 && y == n - 1) { answer = 1; } if (map[x][y] != 1) { if ((map[x][y] != 2) || (map[x][y] == 2 && direction == RIGHT)) answer += result(m, n, x + 1, y, RIGHT); if ((map[x][y] != 2) || (map[x][y] == 2 && direction == DOWN)) answer += result(m, n, x, y + 1, DOWN); } return answer; } void main() { cout << result(3, 6, 0, 0, NONE) % 20170805; int i; cin >> i; }