private static String getConfiguration(int rows, int columns, int mines){
		
		/*
		 * .*
		 * ****
		 * ****
		 */
		int rows1 = rows;
		int columns1 = columns;
		int mines1 = mines;
		/*
		 * .***
		 * ****
		 */
		if (mines > columns){
			mines1 = mines % columns + columns;
			rows1 = rows - (mines/columns) + 1;
		}
		
		if (mines1 > mines){
			mines1 = mines;
			rows1 = rows;
			columns1 = columns;
		}
		
		if (mines1 > rows1){
			columns1 = columns - (mines1/rows1) + 1;
			mines1 = mines1 % rows1 + rows1;
		}
		
		if (mines1 > mines){
			mines1 = mines;
			rows1 = rows;
			columns1 = columns;
		}
		
//		if (mines > columns){
//			mines1 = mines % columns;
//			columns1 = columns - (mines/columns);
//		}

		String result = "\nImpossible";
		StringBuilder configBuilder = null;
		String config;

		int cells = rows1 * columns1;
		int mapSize = (int) Math.pow(2, cells);

		for (int i = 0; i < mapSize; i++){
			if (countMines(i) != mines1){
				continue;
			}

			configBuilder = new StringBuilder(cells);
			config = Integer.toBinaryString(i);

			if (config.length() != cells){
				for (int j = 0; j < cells - config.length(); j++){
					configBuilder.append(".");
				}
			}

			configBuilder.append(config);
			config = configBuilder.toString().replace("0", ".").replace("1", "*");

			String[] configIndex = new String[1];
			configIndex[0] = config;
			if (isConfigWin(configIndex, rows1, columns1)){
				result = getWinningConfig(configIndex, rows, columns, rows1, columns1);
				break;
			}
		}

		return result;
	}