static int entrance() {
        int x = 0, y = 0;
        for (int i = 0; i < layout.length; ++i)
            for (int j = 0; j < layout[i].length; ++j) {
                if (layout[i][j] == 2) {
                    x = i;
                    y = j;
                    break;
                }
            }
        leastTime[x][y] = 0;
        List<Point> resetPoints = new ArrayList<>(layout.length);
        List<Point> endPoint = new ArrayList<>(1);
        resetPoints.add(new Point(x, y));
        while (!resetPoints.isEmpty()) {
            List<Point> nextResetPoints = new ArrayList<>(layout.length);
            for(Point point : resetPoints){
                babyRun(point.x,point.y,leastTime[point.x][point.y],0,nextResetPoints,endPoint);
            }
            if(!endPoint.isEmpty()){
                Point end=endPoint.get(0);
                return leastTime[end.x][end.y];
            }
            resetPoints=nextResetPoints;
        }
        return -1;
    }