# Escape Wall Maria

## 문제

Wall Maria has been broken! Eren must evacuate as soon as possible from his house. He must find the fastest route to escape within Wall Maria before the titans rush in. Wall Maria is represented as a N×M grid in which Eren can move horizontally or vertically.

There are burning houses and buildings which prevent Eren from passing through them. The burning houses and buildings are represented as '`1`'. Unburned or safe areas are represented as '`0`'. There are some areas which can be entered but only from a specific direction. These areas can be represented by either '`U`', '`D`', '`L`', or '`R`'. For example, if there is an '`R`' that means that area can only be entered from the right neighboring tile within Wall Maria's grid. Similarly, '`U`' tiles can only be entered from above, '`D`' tiles can only be entered from below, and '`L`' tiles can only be entered from the left.

Eren knows the time t at which the titans will rush in. It takes 1 unit of time to traverse 1 zone (which corresponds to 1 tile in the grid). Once he reaches any border of Wall Maria he is safe.

Eren's starting position is represented by the letter '`S`'. If Eren escapes at or before time t, he is safe. Given his position within Wall Maria determine if it is possible to escape. If it is possible determine the number of zones that must be traversed to lead to the quickest escape.

## 입력

The input consists of a single test case. The first line contains three integers t (1≤t≤200) , N (1≤N≤100) and M (1≤M≤100). The rest of N lines will be Wall Maria's grid containing characters '`1`', '`0`', '`S`', '`U`', '`D`', '`L`', or '`R`'. There is exactly one '`S`' in the input.

## 출력

If it is possible to escape Wall Maria, output the minimum number of zones that must be traversed to escape. If it is not possible to escape, print "`NOT POSSIBLE`"!

## 예제 입력 1 복사

    2 4 4
    1111
    1S01
    1011
    0U11

## 예제 입력 2 복사

    2 4 4
    1111
    1S01
    1011
    0L11

## 예제 입력 3 복사

    1 4 4
    1S01
    1001
    1011
    0U11

## 예제 출력 1 복사

    2

## 예제 출력 2 복사

    NOT POSSIBLE

## 예제 출력 3 복사

    0