From 0a36d9db835d2d91c0c0ee58a12deedef3c2faa6 Mon Sep 17 00:00:00 2001 From: tebarius Date: Mon, 16 Dec 2024 11:56:47 +0100 Subject: [PATCH] 16-ki --- 16/16-1-ki.py | 38 ++++++++++++++ 16/ex.txt | 15 ++++++ 16/ex2.txt | 17 ++++++ 16/input.txt | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 211 insertions(+) create mode 100644 16/16-1-ki.py create mode 100644 16/ex.txt create mode 100644 16/ex2.txt create mode 100644 16/input.txt diff --git a/16/16-1-ki.py b/16/16-1-ki.py new file mode 100644 index 0000000..a7becf4 --- /dev/null +++ b/16/16-1-ki.py @@ -0,0 +1,38 @@ +file = './ex.txt' +#file = './ex2.txt' +#file = './input.txt' + +from heapq import heappush, heappop + +def solve_reindeer_maze(maze): + start = next((i, j) for i, row in enumerate(maze) for j, cell in enumerate(row) if cell == 'S') + end = next((i, j) for i, row in enumerate(maze) for j, cell in enumerate(row) if cell == 'E') + + directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] + heap = [(0, start[0], start[1], 0)] + visited = set() + + while heap: + score, row, col, direction = heappop(heap) + + if (row, col) == end: + return score + + if (row, col, direction) in visited: + continue + + visited.add((row, col, direction)) + + for new_direction in range(4): + new_row, new_col = row + directions[new_direction][0], col + directions[new_direction][1] + if 0 <= new_row < len(maze) and 0 <= new_col < len(maze[0]) and maze[new_row][new_col] != '#': + new_score = score + 1 + if new_direction != direction: + new_score += 1000 + heappush(heap, (new_score, new_row, new_col, new_direction)) + + return float('inf') +# Einlesen des Labyrinths und Lösen +maze = [list(line.strip()) for line in open(file, 'r')] +result = solve_reindeer_maze(maze) +print(f"Die niedrigste mögliche Punktzahl ist: {result}") diff --git a/16/ex.txt b/16/ex.txt new file mode 100644 index 0000000..2c21676 --- /dev/null +++ b/16/ex.txt @@ -0,0 +1,15 @@ +############### +#.......#....E# +#.#.###.#.###.# +#.....#.#...#.# +#.###.#####.#.# +#.#.#.......#.# +#.#.#####.###.# +#...........#.# +###.#.#####.#.# +#...#.....#.#.# +#.#.#.###.#.#.# +#.....#...#.#.# +#.###.#.#.#.#.# +#S..#.....#...# +############### diff --git a/16/ex2.txt b/16/ex2.txt new file mode 100644 index 0000000..bc61c57 --- /dev/null +++ b/16/ex2.txt @@ -0,0 +1,17 @@ +################# +#...#...#...#..E# +#.#.#.#.#.#.#.#.# +#.#.#.#...#...#.# +#.#.#.#.###.#.#.# +#...#.#.#.....#.# +#.#.#.#.#.#####.# +#.#...#.#.#.....# +#.#.#####.#.###.# +#.#.#.......#...# +#.#.###.#####.### +#.#.#...#.....#.# +#.#.#.#####.###.# +#.#.#.........#.# +#.#.#.#########.# +#S#.............# +################# diff --git a/16/input.txt b/16/input.txt new file mode 100644 index 0000000..31204d9 --- /dev/null +++ b/16/input.txt @@ -0,0 +1,141 @@ +############################################################################################################################################# +#.#.....#.........#...#.......#.......#.......#.................#...#...#.........#...#.........#.....#.....#.......#.......#...#.......#..E# +#.#.###.#.###.#####.#.#.#####.#.#.###.#.###.###.#####.#.#######.#.###.#.#.###.#.#.#.#.#.#####.#.#.###.#.#.###.#.#####.#.###.###.#.###.#.#.#.# +#.....#.#...#.......................#...#...#.....#...#.#.....#.......#...#...#.#...#...........#...#...#.....#.#.....#...#.....#...#.#.....# +#.#####.###.#.#.#####.#####.###.###.#########.#####.#####.###.#.#.#.#######.###.#####.#.###.#.#####.#######.###.#.#######.#######.###.#####.# +#.#...#.#...#...#...#.....#.#.#...#...........#...#.#.....#...#.#.#...#.......#.#.....#...#.#...#...#...#.....#...#.#...#.........#...#.....# +#.#.#.#.#.###.#.###.###.###.#.#.#.#############.#.#.#.#####.###.#.###.#.#####.#.#########.#.###.#.###.#.#.###.#####.#.#.###########.###.#.#.# +#...#...#.....#...#...#.....#...#.....#.....#...#.#.#.#...#...#.#.#...#.#.....#.............#...#.#.#.#...#.......#...#...#.........#...#...# +###.###.#####.#.#.#.#.#########.###.#.###.#.#.###.#.#.#.#####.#.#.#.###.#.###.###############.#.#.#.#.#####.#####.###.#.###.###########.##### +#...#...#...#...#...#.#.#...........#.......#.#.....#.#.....#.#...#.#...#.#.....#...........................#.......#.#...#...#.......#.....# +#.###.###.#.#.#.#####.#.#.###.#.#########.#.#.#######.#####.#.#.#.#.#.###.#####.###.#######.#####.#.###.#.#########.###.#.###.#.#####.#####.# +#.#...#...#.........#.#...#...#.#.......#...#.......#.#.....#...#.#.#.#.#.........................#.#...#.......#.#...#.#...#.#...#.#...#...# +#.#.#######.#.#.#####.#####.###.#.#.#####.#######.#.#.#.###.###.###.#.#.###.#.###.#.#.###.#.#.#####.#.#########.#.###.#.#.###.###.#.###.###.# +#.#.......#...#.....#.....#.#.....#.#.....#...#.#...#.#.#...#...#...#.....#.#.......#.#.....#...#.....#...................#...#...#...#...#.# +#.#######.#####.###.#####.#.###.###.#.###.#.#.#.#.###.#.#.###.###.###.#####.#.#######.#.#######.#.#####.#########.#.#.###.#.###.###.#.###.#.# +#.#...#...#...#.#.#.....#.#...#...#.........#...#...#...#...#.....#...#.....#.#...#...#.#.....#.#.....#.........#.#.#.#...#.........#.#...#.# +#.#.###.###.#.#.#.###.#.#.###.###.#########.###.###.#######.#######.#.#.#######.#.#.###.#.#.###.#####.#########.#.#.#.#.###############.###.# +#.#.........#.#...#...#...#...#.....#.......#...#.#.......#.#...#.....#...#.....#...#...#.#.....#...#...#.....#.#.....#.................#...# +#.###########.#####.#.###.#.#######.#.#######.###.#######.#.###.#.#######.#.#########.###.#######.#####.#.###.#.#.#######.#.#.#########.##### +#.#...#.....#...#...#.#...#.....#...#.#.....#.#.....#...#...#...#.#.......#.#.......#...#...#.#.........#...#...#...#.....#.#...#.#.....#...# +#.#.#.#####.###.#.###.#.#######.#.###.###.###.###.#.###.#.###.###.#.#.#.###.#.#####.#######.#.#.#####.###.#.#######.#.#.#.#####.#.#.#####.#.# +#...#.#.....#.#.#...#.#.#.......#.#.....#...#.....#.#.......#.#...#.#...#...#...#.#...#.....#...#...#.#...#.....#...#.#.#.......#...#...#.#.# +#####.#.###.#.#.#.#.#.#.#.#######.###.#.#.#.#######.#.#####.#.#.###.#.###.#.###.#.###.#.#########.#.###.###.#####.###.#.###.#####.###.###.#.# +#...............#.#.#.#...#.....#.....#.#.#...#...#.#...#.#.....#...#...#.#.#.......#.#...#.......#.....#.....#...#...#...#.#.......#...#.#.# +#.#.#.#.#.###.#.#.#.#####.#.#.#.###.###.#.###.#.#.#.###.#.#.#####.#######.###.#######.#.#.#.###############.#.#.#########.#.#.#####.###.#.#.# +#.......#.#.#.#.#.....#...#.#.#...#.#...#...#.#.#.#.....#.#.......#.....#...#...#...#.#...#.#.#.....#.......#.#.#.....#...#.#.#...#.....#.#.# +#.#######.#.#.#.###.#.#.#.#.#.#####.#.#####.#.#.#.#######.#####.#.#.###.###.#.###.#.#.#.###.#.#.#.#.###.###.#.#.###.#.#.###.#.#.#.#####.#.#.# +#...#.....#...#...#.....#...#.......#...#...#...#...#...#.......#...#...#.#...#...#...#.#...#...#.#.....#...#.#.#...#...#...#...#.....#.#.#.# +#.#.###.#######.#.#.#.#.###############.#.#######.#.#.###.###########.#.#.#####.#####.#.###.#.###.#.#######.#.#.#.#####.#.#.#.#######.###.#.# +#.#...#...#...........#...#.#...........#.....#...#.#.#...#...#.........#.#.....#.#...#.....#...#...#.....#...#.#.#.....#...............#.#.# +#####.#.#.#.#############.#.#.#####.#.###.#####.###.#.#.###.###.#.#####.#.#.#####.#.#############.#.#.###.#####.#.#####.#######.#######.#.#.# +#.....#.#.#...#...........#...#...#...#...#.....#.....#...#.....#.#.......#.....#.#...#...#.....#.#.#...#.#...#.#.#...........#.......#...#.# +#.#####.#.###.#.###############.#.#.#######.#.###########.#.#####.#.###########.#.###.#.#.###.#.#.#####.#.#.#.#.#.#.#.#.#####.#.#####.#####.# +#.......#...#.#...#.....#.......#...#.......#.#...........#.#...#.#...#.........#...#...#.....#...#...#.#.#.#.#.#...#.#.......#...#.....#.#.# +#.#.###.#.###.###.###.#.#.#############.#####.#.#.###########.#.#.#.###.#########.###.#############.#.#.#.#.#.#.#.###.###########.#.###.#.#.# +#.#.....#.....#...#...#.#.....#...#.....#...#.#.....#.........#.#.#.#...#...#...#.....#...#...#...#.#...#...#...#...#.......#.....#.#.....#.# +#.###########.#.###.###.###.#.#.#.#.#.#####.#.#####.#.#####.###.#.#.#.###.#.#.#.#######.#.#.#.#.#.#.###############.#######.#.#####.#####.#.# +#...........#.#.....#.....#.#.#.#.#.#.#...#.......#.#.#...#.#...#.#.#.....#...#.#...#...#...#...#...#.#.............#.....#...#...#...#...#.# +#.#########.#########.###.#.#.#.###.#.#.#.#.#######.#.###.#.#.###.#.###########.#.#.#.###############.#.###############.#.#######.###.#.###.# +#.#.......#.#.........#...#.#.#.....#.#.#...#...#...#...#.#.#...#.#...#.#.....#...#...#...#.......#.....#.........#.....#.#.........#.#.....# +#.#.#####.#.#.###.###.#.#####.#.###.#.#.#.#.#.#.#.#####.#.#.###.#.###.#.#.###.#########.#.#.#####.#.#####.#######.#.#.###.#.#####.###.###.#.# +#.........#...#.#.#...#.#.....#.......#.#.#.#.#.#.....#...#.....#.#.#.#.#.#.........#...#...#...#...#.....#...#...#.#...#...#...#.#...#...#.# +###.#######.###.#.#.###.#.#####.#######.#.###.#.#####.#######.#.#.#.#.#.#.#.#######.#.#.###.###.#####.#######.#.###.###.#.###.#.###.###.###.# +#...#.....#...#.#.#.#...#...#.#.........#.#...#.....#...#.....#.#.#.#.#...#.#.....#.#.#...#.....#.#...#.....#...#.....#.#.#...#.....#...#.#.# +#.###.###.###.#.#.#.#.#####.#.#.#######.#.#.#.#.#######.#.#####.#.#.#.#####.###.#.#.#.###.#####.#.#.#.#.###.#.###.###.#.#.#.#######.#.###.#.# +#...#.#.#...#...#.#.#.#.....#...#.....#.#.....#.......#.#.#...#...#.#.......#...#.#...#.#.....#.#...#...#.#.........#.#.#.#.#.#.............# +###.#.#.###.###.#.###.#.#####.###.###.#.#########.#.#.#.#.#.#.#####.#########.###.#####.#####.#.#####.###.#.#######.###.#.#.#.#.#.#.#.###.#.# +#...#.#.#...#.#.#.......#...#.#.......#...#.....#...#.#...#.#.................#...........#...#.#...#.#...#...#...#.....#.#.#.......#...#...# +#####.#.#.###.#.#########.#.#.#.###.#######.###.#.###.#####.#########.#################.###.###.#.#.#.###.###.#.#.#########.#.###.#.###.###.# +#.......#...#...#.........#.#.#.#.....#.....#...#...#.......#.........#...#.....#...#...#...#...#.#.#.....#...#.#...........#.#.#.#...#...#.# +#.#########.#.###.#########.#.#.#####.#.#####.###############.#######.#.#.#.###.###.#.###.###.###.#.#####.#.###.###.#########.#.#.###.###.### +#.#...#.....#...#...#.#.....#.#...#.#...#.............#.....#.....#...#.#.#...#...#.#...#...#.....#...#...#.#...#...#...#...#...#.#...#.#...# +#.#.#.#.#####.#.###.#.#.#####.###.#.#####.###########.#.###.#####.#####.#.###.###.#.#.#####.#########.#.###.#.###.###.#.#.#####.#.#.###.###.# +#.#.#.#.........#.....#.#.....#...#.....#.#.#.......#...#.#.#...#.......#...#.#...#...#...#.......#.......#.#.#...#...#.#.......#.......#.#.# +#.###.###.###.#.#.###.#.###.###.#.#####.#.#.#.#.###.#####.#.#.#.###.#####.###.#.#####.#.#.#######.###.#####.#.#.###.###.###############.#.#.# +#...#.#.......#.#...#.....#.#...#.#...#.....#.#...#.....#.#...#...#...#...#...#.....#...#.......#...#.......#.#.#...#.....#...........#...#.# +###.#.#.#.###.#.###.#####.###.#####.#.#######.###.#####.#.#######.#####.###.#.#####.###.#.#####.###.#######.#.###.#######.#.#.#######.#####.# +#.#.#.#...#...#.#.#...#.....#.#.....#.#...#...#.......#.#.......#.....#.....#.....#.....#...#.....#...#.....#...#.......#.....#...#.#.....#.# +#.#.#.###.#.#.#.#.###.###.#.#.#.#####.#.#.#.###.###.###.#.#####.#####.#.#####.#.#.###.###.#.#.###.#.#.#.###.###.#####.#.#.#####.#.#.#####.#.# +#...................#.....#...#.....#...#.....#.#...#...#.#...#.....#.#...#...#.#.#...#...#...#.....#...#...........#.#.#.#.....#...........# +#.###.#.#.###.#####.#####.#.#######.#########.#.#####.###.#.#.#####.#.###.#####.#.###.#.#.#########.#####.###########.#.#.#.#####.#.#.#####.# +#.#.#...#.........#...#...#.#.......#.....#.....#.....#...#.#.#...#.....#.......#.#...#.#.#.......#.......#.......#...#.#.#...#.#.#.#.....#.# +#.#.#.#.#.###.###.#####.#####.#######.###.#.###.#.#####.###.#.#.#.#####.#########.#.#.#.###.#####.#.#####.#.#####.#.###.#.###.#.#.#.#####.#.# +#.#...#.......#...#...#.......#.......#.#.#.....#.#.....#...#...#.....#.....#.....#.#.#.....#.....#.#.........#...........#.#.#.#.#.....#...# +#.#.###.#.###.#.###.#.#########.#######.#.#.#####.#######.###########.#####.#####.#.#########.#####.#.#######.###########.#.#.#.#.###.#.###.# +#.#...#.#.....#.....#.........#.#.......#.#.....#.#.....#.......#...#.....#.....#.#.......#...#...#.#.......#...#...#...#.#.#.#.#...#.#.#...# +#.###.#.#.#.#.###.#######.#.###.#.#####.#.#####.#.#.###.#.#.###.#.###.###.#####.#.#.#.###.#.###.#.#########.###.#.#.#.#.#.#.#.#.###.#.###.### +#...#.#.#...........#.....#.#...#.#.#...#.....#.#...#...#.#.#.#.#.#.....#.#...#.#...#...#.#.....#.........#.#...#.#...#.#...#...#.#.#.....#.# +###.#.#.#.###.###.#.#.#######.###.#.#.#.#####.#.#####.#.#.#.#.#.#.#.###.#.#.###.#.#.###.#.#############.###.#.###.#####.#######.#.#.#.#####.# +#.................#.#.....#...#...#.#.......#.#.#.....#.#...#.#.#.#.#.#.#.#...#.#.#...#.....#.....#...#...#.#...#...#...#...#...#.#.#.......# +#.#.###.#.###.#.#########.#.###.#.#.#######.#.###.###########.#.#.#.#.#.#.###.#.#.###.###.#.#.###.#.#.###.#.###.#.###.###.#.#.###.#.#.###.#.# +#.#...#.#.#...#.#.........#.#...#.#.........#.....#...#...#...#.#.#.#.#.#.#...#.#.#.....#.#...#.#...#...#...#.#.#.#...#.......#...#.#.....#.# +#.###.#.#.#.#.#.#.#####.#.#.#.###.###.#.#########.#.#.#.#.#.#.#.#.#.#.###.#.#.#.#.#####.#.#.###.#######.#####.#.#.#.###.#######.#.#.#######.# +#...#.#...#.#.........#...#.#.#.#...#...#.....#...#.#...#...#.....#.#.....#...#.#...#...#...#.....#.....#.....#...#.....#.....#.#.#.#.......# +#.###.#.#.#.###.#####.#.###.#.#.###.###.#.###.#.###.###########.#.#.#.#.###.###.###.#######.#.#####.#####.#.#####.#######.###.#.#.#.#.#.##### +#.#...#...#.#.#...#...#...#.#.....#...#...#...#...#...............#.....#...#...#...........#.#...#...#.#.#...........#.#...#...#.#.#.......# +#.#.#####.#.#.###.#.#####.#.#.#####.#.###########.###.#######.###.#########.#.###############.#.#.###.#.#.#########.#.#.#.#.###.###.###.###.# +#...#.....#.#.....#.....#.#.#.#...#.#.............#...#...#...#.#.#.........#.........#.........#...#.#...........#.#.#.....#...#...#.....#.# +#.#####.#.#.###.#######.###.###.#.###############.#.###.#.#.#.#.#.#.#.###############.###########.###.#.#####.#####.#.#####.#####.###.#.###.# +#.#.....#.#...#...#...#...#.....#.....#.........#.#...#.#...#...#...#.#.............#...#.............#.#...#.....#.#.......#...#.#.#.#...#.# +#.#.#####.#.#.###.#.#.###.###########.#.#######.#####.#.#####.###.#.#.#.###########.###.#.#####.###.#####.#.#.###.#.#########.#.#.#.#.#.#.#.# +#...#...........#.#.#.#.#...........#...#...#.#.......#.#.#.......#.#...#.........#.....#.....#...#...#...#...#.#...#.........#.#.#.#.#.#...# +#####.#.#.#.###.#.#.#.#.#.#.###.###.#####.#.#.#########.#.#.#######.###.#####.###.###########.###.###.#.#######.#.###.#########.#.#.#.#.##### +#.............#...#.#...#...#.#.#...#.....#...#.........#.........#...#.....#...#...#...#...#...#.#.....#.....#.#.#...#.......#...#.#...#...# +#.#.#####.#.###.###.#########.#.#.#####.#######.###.#############.###.###.#.#####.#.#.#.#.#.###.#.#####.#.###.#.#.#.###.#.#######.#.###.###.# +#.#.#.....#.#...#.............#.#.#...#...#.......#.....#.......#.#.#.....#.......#.#.#...#.#...#.#...#.#.....#...#.#...#.#.....#.....#.#...# +#.###.###.#.#.###.#.###.#.#####.#.#.#.###.#.###########.#.#####.#.#.#############.#.#.#####.#.###.#.#.###.#.###.###.#.###.#.###.#.#.###.#.#.# +#...#.#.#.#...#.....#...#.#.....#...#.#...#.#...#.....#.#...#...#...#.....#.......#.....#.#...#...#.#.....#...#...#.#.#...#.#.#...#...#...#.# +###.#.#.#.#.#########.###.#.#########.#.#.#.###.#.###.#.###.#.#####.#.###.#.###.###.###.#.#####.###.#########.#####.#.#####.#.###.###.#.#.#.# +#...#...#.#.#.......#.#.......#.....#.#.#.#...#.#...#.....#.#...#.....#...#...#.....#...#.#.........#.......#.....#.#.#.....#.....#.#...#...# +#.###.###.#.###.###.#.#.#####.#.###.#.#.#.###.#.###.#######.###.#############.#######.###.#.#########.#####.#####.#.#.#.#####.###.#.#.#.#.### +#...#.#...#...#...#...#.#...#.#...#.....#.#.#.#...#.......#...#...........#...#.......#...#.#...#.........#.....#.....#.......#.....#.#.#.#.# +#.#.#.#.#####.###.#####.#.#.#.###########.#.#.###.#######.###.#######.###.#.#########.#.###.#.#.#.#########.#.#######.###.#.#####.#.#.#.#.#.# +#.#...#.....#...#...#.....#.#.......#...#...#...#.......#.....#.......#...#.......#...#.....#.#.#...#.......#.......#.....#.....#...#.....#.# +#.#######.#####.#.#.#######.#######.#.#.#######.#.#####.#############.#.#########.#.#.#####.#.#.###.#.#########.#.###.###.#.###.#.#####.#.#.# +#.#.....#.#...#.#.#.#...#...#.....#...#.#.......#.#.....#.............#.........#.#...#...#...#...#.#...#.......#...#.#...#.#...#.......#...# +#.###.###.#.#.#.#.#.#.#.#####.###.#####.#.#######.#####.#####.#.#.#.#.#######.###.#.###.#.###.#.#.#.###.#.###.#.###.#.#.#.#.#.#########.#.#.# +#...#...#.#.#.#.#.#...#...#...#.#...#...#...#.#...#...#.#.....#...#.#.#.#.....#...#...#.#.......#.#...#.#...#.#.....#.#.#...#.......#.#.....# +###.###.#.#.#.#.#.#######.#.###.#.###.#####.#.#.#.#.#.#.#.#####.###.#.#.#.#.###.###.#.#.#########.###.#.###.#.#.#.###.#####.#######.#.###.#.# +#.#...#.#...#...#.#.....#...........#.....#.....#...#.#.#.#.#...#...#...#.#.#...#...#.......#.....#...#...#.#...#...#.....#.#.#.....#.....#.# +#.#.#.#.#####.###.#####.###########.###.###.#.###.#.#.#.#.#.#.#####.###.#.###.###.###########.#########.#.#.#######.#####.#.#.#.#####.#####.# +#...#.#...#.....#...#.....#.....#.....#.#...#.#.#...#.#.............#...#.....#.#.....#.#.....#.........#.#.#.....#.......#...#.#.....#.....# +#.#.#.#.###.###.###.#.#####.###.#.###.#.#.###.#.#####.#####.###################.#####.#.#.#####.#######.###.#.#.###############.#.###.#.##### +#.#.#.#...#...#.#.....#...#...#...#...#...#.......#...#.....#.#...........#.........#.#.#.#.....#.......#...#.#...............#.#.#...#.#...# +#.#.#.###.###.#.#.#####.#.###.#####.###############.###.###.#.#.#.#####.###.#######.#.#.#.###.#######.###.#########.#########.#.#.#.###.###.# +#.#.#...#.....#...#.....#.....#...#.......#.......#.#.........#.#.........#.#.....#...#.#...#...#...#.#.#.......#...#.......#...#.#...#.#...# +#.#####.#.#####.###.#.#########.#########.#.#####.#.#.#####.#.#.###.#####.#.#.#.#.#####.###.#.#.#.#.#.#.#.#.#.#.#.###.###########.###.#.#.#.# +#.#.....#.#...#...#...#.#...#...........#.#.....#...#...#...#.#...#.....#...#.#.#.......#...#.#...#.#...#.#.#...#...#.#.........#.#.#.#...#.# +#.#.#######.#.###.###.#.#.#.#.#######.#.#.#####.#######.#.###.###.#####.#######.#######.#.###.#####.#.###.#.#.#.###.#.#.#######.#.#.#.#####.# +#...#.......#.#.....#.#...#.#.#.#...#.#.#.....#.....#.#...#...#.#...............#...#...#.#.#...#...#.#.....#.....#.#...#.....#...#.#.....#.# +#.#####.#####.#####.#.#.#.#.#.#.#.#.#.#.#####.#.###.#.#.###.###.#####.#########.#.#.#####.#.#.#.#.###.#.###.#####.#.#.###.#.#.#####.###.###.# +#.......#...#...#...#.#...#.#.#.#.#.#.#...#...#...#.#.....#...#.#...#.......#.....#...#...#.....#...#.#...#.....#.#.#.....#.#.....#...#.#...# +#########.#.###.#####.#.###.#.#.#.#.#.#####.#######.#.###.###.#.#.#.#.#.###.#.###.###.#.###.#######.#.###.#####.#.#.#######.#####.#.#.#.#.### +#...#.....#...#...#...#.#.#.....#.#...#...........#.#...#...#...#.#...#.#...#.#.....#.#.#.#.#.....#.#.....#.....#.#...#...........#.#.#.....# +#.#.#.#####.#.###.#.###.#.#.#####.###.#.#.###.#.#.#.###.#.###.###.#####.###.#.#.#.###.#.#.#.###.#.#.###.#.#.#.###.###.#######.#.#.#.#.#.###.# +#.#.#.#...#.#...#.#.#.#.#...#.....#...#.....#.#.#.#...#.#...#.#...#...#...#.#.#.#...#.#.#...#...#.#...#.#.#...#.#...#.#.......#.....#.#...#.# +#.###.#.###.#####.#.#.#.###.#.#############.#.#.#.###.###.#.#.#.#####.###.#.#.#.###.#.#.#.###.#.#####.#.#.#.#.#.###.#.#.#####.#######.###.#.# +#.....#...#.#...#...#.#.#...#...#...#...#...#...#...#...#.#...#.......#...#...#...#...#.#.#...#.#...#.#.#.#.#.#...#.#...#...#.....#...#...#.# +#.#######.#.#.#.#####.#.#.#.###.#.#.#.#.#.###.#####.###.###########.###.#########.#####.#.#.###.#.#.#.###.###.#.#.#.#.###.#.#####.#####.###.# +#.........#...#.......#.#.#...#...#.#.#...#.....#.....#.....#...#...#...#.......#.......#...#.....#.#...#.....#.#.#.#.#...#.......#...#.....# +#####.#######.###.###.#.#.###.#####.#.#####.###.#####.#####.#.#.#.###.###.#####.#############.#####.#.#.#######.###.#.###.#####.#.#.#.#####.# +#...#.#.....#...#...#.#.#.#...#...#.#.....#...#.....#.......#.#...#...#.......#.#...........#...#.#.#.#.......#.....#...#.....#.#...#.....#.# +#.#.#.#.###.#######.###.#.#####.#.#.#####.#.#######.#######.#.#####.###.#####.###.#####.###.###.#.#.#####.###.#.#######.#####.#.#######.#.#.# +#.#...#.#...#.....#.#...#.......#.#.......#.#.....#.....#...#.#...#.#.....#...#.........#...#...#.#.......#...#.....#.........#...#...#.#.#.# +#.#####.#.###.###.#.#.###########.###########.#.#.#.#.###.###.#.#.#.#####.#.###.#####.#.#.###.###.#.###############.#.#######.#####.#.###.#.# +#.....#.#.#...#.....#...........#.......#.....#...#.#...#...#.#.#.#...#...#.....#...#.#.#...#.#.....#.......#.....#.#.#...#...#...#.#.#...#.# +#####.#.#.###.#.###.###.#.#####.#.#####.###.###.###.#.#.###.#.###.#.#.#.#.#######.#.###.###.#.#.#####.#####.#.#.#.#.###.#.#.###.#.#.#.#.#.#.# +#...#.#.#.....#.#.........................................#.#...#...#...#.....#...#.....#...#.#.#...#.#...#.#.#.#.#...........#.#...#...#.#.# +#.#.#.#.#####.###.#.###.#.###.#.#.#.#########.#.#.#.#.###.#.###.###.###.#####.#.#########.###.#.###.#.#.#.#.#.#.#####.#.#.#####.#########.#.# +#.#...#.#.....#...#.....#.#...#...#.........#.#.....#...#...#...#.....#.....#.#...#.....#.....#.#...#...#.#...#.....#...#.#.....#.......#...# +#.#####.#.#####.###.#.#.#.#########.###.#####.#.#.###.###.###.###.#.#######.#.###.#.#.#########.#.#.###.#.#######.#.#####.#.#####.###.###.### +#.....#.#.....#.....#.#.#...#.....#...#.....#...#.......#.#...#...#.........#.#.#.#.#.........#...#.....#.....#...#...#.#.#...#.....#...#...# +#####.#.###########.#.#.#.#.#.###.###.#####.###.#.###.#.###.#####.#.#.#.#####.#.#.#########.#.#.###.###.#.#.###.#####.#.#.###.#.#######.###.# +#.....#...#.......#.#.#...#.#...#.#...#.#...#...#...#.#.#...#.....#.#.#.....#.#.#.........#.#...#.......#...............#.....#.#...#...#...# +#.#######.#.#.###.#.#.#.#.#.###.#.#.###.#.###.#.#.#.#.#.#.#####.#.#.###.###.#.#.#########.#.###.#.###.#.###.#.###.#.###.#########.#.#.#.#.### +#.#.......#.#...#...#...#.#...#.#.#...#.#.....#...#.#.#.........#.#.......#.#.#...........................#.#...#.#.........#.....#...#.#.#.# +#.#.#######.#.#.#####.#.#.#.#.#.#.###.#.#######.#.#.#.#.###########.###.###.#.#.###.#.#########.#######.#.#.###.#.#.#######.#.#####.#####.#.# +#.#.#.......#.....#...#.#.#.#...#...............#.#.#.............#...#.#...#.#...#.#.#.......#.........#.......#.#.....#.....#.....#...#.#.# +#.#.#.#######.###.#####.#.#.#######.#.#####.###.#.#.#.#.#########.#.#.#.#.###.###.#.#.#.#####.#.#####.#####.###.#.#.###.#############.#.#.#.# +#S#...........#.........#.........#.........#.........#.............#.....#.......#.#.......#.......#...........#.....#...............#.....# +#############################################################################################################################################