using System.Collections.Generic;
public static void Main()
int start = input.IndexOf('^');
HashSet<int> visited = new();
while(GetAt(x,y) != ' '){
var next = GetAt(x + dx, y + dy);
if (dx == 1){ dx = 0; dy = 1; }
else if (dy == 1){ dx = -1; dy = 0;}
else if (dx == -1){ dx = 0; dy = -1; }
else if (dy == -1){ dx = 1; dy = 0;}
Console.WriteLine(visited.Count);
public static int To1D(int x, int y) => y*131+x;
public static char GetAt(int x, int y) {
if(x >= 0 && x < 130 && y >= 0 && y < 130) return input[To1D(x,y)];
@"#.............#.#...........................................................#..........#...........................#..........#...
............#......................#.......#..#.........#...................##....................................................
..............#...........#..#.......#.........#.#...........................#................................#......#............
.....#......................................#......#..#...................#....................#......................#...........
...#............................#................................#................................................................
..........#..................#.....#......................................................#.......................................
..#........#.......#.#...............................................................#......#.................................#...
.#....#................#................#.....#...................#...............................................#..#............
.......................................................................................#...#.#....#........##......#........#.#.##
............................................#.................#.....................#..........................#..................
....#..........##......................#.................................................................................#........
......#.............##.........#.......#.........#.......#.............#...#.......#..............................................
.#............................................................................#..........#....#...................................
...#..#....#..............................#...........................................................................#...........
.............#....................................................................................................................
................................#..................##...................................#...............................#......#..
..........#.........#.................#..........###...........................................#............#...#.................
.............#....................................#.......#.#.#............#............................................#.........
......#.#..............................................................................................#.........................#
...#...#.........#.........#..#......#................##.................#........................................................
.................................#......................#........#................#........................#......................
.......................##..............#................#................#..............................#.........................
.......#...#.....#.....##........................#..................##.....#......................................................
.............................................#...........................#..........................................#.....#.......
.........................#...............#....#..............#.......#...............#.#.................#.................#......
...........................................................#....#..................................#..............................
..........................#.................................................#............................##....#..................
.................#...#.........................................................#........................#.....#..#................
.........................#....#................................................#...#.....................#....#...........#.......
................................................##.......#.#....................................#.......##........................
..........##...#.......................#....#..#....................#........................#....................................
#......#.......................#............#.....................................................................#...............
.......#.......#...#..#..........#.......................................#.............#......#...................................
...............#............#..................#.................................................................................#
.......#...........#.......................##.....#.........#...........#...................#......#.........#.............##....#
...................#.........................#......#..........................................#..........#.........#......#......
.....#............#..............#...#......#....................#.............#..................................................
................................................#........#.....#...................#.....................................#.....#..
......................#.#...##......................##...............................................#.................#..........
#...................#.........................#...........#.....#................#.....................#...................#......
....#................#.....#.............#.....................................#....#...#.................................#.......
.........#.....................................................................................................#.#.......#........
.........#..........##..............................#............................#.#.............................#................
#....#.#..............................................##...#...#...............#.............#....................................
........#..#.#...................#.......................................................................#.............#..#.#...#.
.................................................................................................................#.......#........
............................................#..#...............##........#..........#.......................................#....#
........#...........................#............................#.....#........................#..........#...#..........#.......
.#...........#...................................................#...........................................#................#.#.
............#...............................#........#...........#..........#...........#.#..............#........................
...............................................................................##.#................#..............................
.#.......................#.#...........#..................................#.......................................................
..#..............................................##................#.......#....#..............#.....................#...#........
...................#.....#................................................#..........#.........#.........#.....................#..
........#................#................................................................................#......#................
...................#...#....#.........................#.........................#....................#..........................#.
.................#.......................................................#................................................#.......
..#...........................##.#.............#..#............................................#.......................#.#........
..#......#.........................................................................#.......................#......................
...........................................................................................................#............#......#..
............................................................^..........................................#..........#...............
..#.........#....................#..........................................#........#.........................................#..
........#...............#....#.............#......#.........................................................................#.....
.........#......#.....#..............#...........................................................#..............#.................
.........#...................................................#...###...........#.......#.##.......................................
.....................##.................#.........##.....................#................#................#.........#............
.......................................................................#..............#..............#.................#..........
.##.........#..........................................................................#....................................#.....
.........................#.............................#........................................................................#.
........#.............................................#......#....#.....................................#....................#....
........#...#..............................................................................#.........#............................
..............................#................................#..........#..............#..................................#.....
........##..#...................................#................................#.................#.........#......#..#........#.
..................#......#...................................................................#....................................
..........#.............#..............#........#............#...............#..#..........#..............#.#...#............#....
............................##....#..............#......................................................................#.........
...............................................#.....#...........#.....##...............#..#......................................
.........................#.......#...............................#...........#.........#...........#....#.........................
.#............#...#...............#..............................................................#..........................#....#
#...........#......................................................#.............................#......#.........................
..................................................#....#...............#.........................#................................
................................................#..........................#.......#..............................#....##.......#.
........#......#..#............#................#............................#......#.##.........#....................#..#........
.......................................................#..#.#....................#..#......................................#......
.....................#.......................................................................#............#.......................
.....................##........................#...................#.....................#........................................
..........................#...........................................................................................#...........
..#..........#...................#..............##..#.....................#...................#..............#...........#........
#................................#....##......#.............#..............#.......................#.........#...........#........
..................#................#...............................#.....#..........#................#..............#.............
................#.#.........#.....##...............................................................#..............#...............
..#...............................................................................................#...............................
..........#.................#...........#.......#.........................#...#.......#...........................................
..##....#......................................#.#.......................................#.................#......................
.......................#..#...#.##......................................................................#.........#...#...........
...............#.........#..............#.....................................................#...................#...............
......#.................#............#......#...................#..#.........................#........................#........#..
......................................................................#...........................#........#......................
..........#..........#........................#.............##....................................................................
....#................................................#.......................#................#...............#...................
.................#....................................................#......#....................................................
.#........#.......................................................................................................................
......##..................#....#......#.................#....................#.....................#..#...........#...............
#...#...#...#..............#........#.......................#.#..........#...............................#......#.................
#...#...................#.............#........#..........#...............................................................#...#...
..#................................#...#.........................#...................#......#.....................................
...#...###..........#............#...............................................................#..........#.....................
............#..............#.......#.....#..........#.....#.........................................................#............#
..#......................#..#...#................................#......#.......#.....#..................#.........#..............
....##......#.......................................................#..............................................#..............
...............................#.....#....#.................................................#.......#............#................
..........#....#......................#........#..........................#......#................................................
......#.............................#...........#..................#...........................#................................#.
...........................##..........................................#.....#.#.....................#................#...........
..#..............#.........................................................#........................#.........#.................#.
#.....#.....#......................#....................#........................................#...........#...........#......#.
.......................................#..#................................#.........#.......#..#.....#..........................#
..........#..............##...............#..........................................................#......#......#......#....#..
.............#..............#..#......#........#..#......##.......................#...........#.......#...........................
......................#.......................................#.......#..#.....................................#.........#...##...
...........................#...........................#......#....#.............................#.............................#..
..................#............................#....#........##.........................#..............#.............#............
.......#....................#.....#........#.......#.#...#...............#.....#.#.........................#.......#.#............
.....#.........#.......#..........#.................#..#...#..................................................##..................
................#........................................................#........................................................
....##......#........#..................#.........................#...................................#...#...................#...
..............#....................#.......#.......................#.............#......#..............#..........................
...........................#..............#.....#............#.....................#........#....#.......................#........
........#..##................#.....#.#..............#..............................#........................#.........#...........
.........................................................#...........................##..........#........#.##....................";