Let's dive into one of the most interesting areas of magic — writing spells. Learning this exciting but challenging science is very troublesome, so now you will not learn the magic words, but only get to know the basic rules of writing spells.Each spell consists of several lines. The line, whose first non-space character is character "#" is an amplifying line and it is responsible for spell power. The remaining lines are common, and determine the effect of the spell.You came across the text of some spell. Spell was too long, so you cannot understand its meaning. So you want to make it as short as possible without changing the meaning.The only way to shorten a spell that you know is the removal of some spaces and line breaks. We know that when it comes to texts of spells, the spaces carry meaning only in the amplifying lines, so we should remove all spaces in other lines. Newlines also do not matter, unless any of the two separated lines is amplifying. Thus, if two consecutive lines are not amplifying, they need to be joined into one (i.e. we should concatenate the second line to the first one). Removing spaces in amplifying lines and concatenating the amplifying lines to anything is forbidden.Note that empty lines must be processed just like all the others: they must be joined to the adjacent non-amplifying lines, or preserved in the output, if they are surrounded with amplifying lines on both sides (i.e. the line above it, if there is one, is amplifying, and the line below it, if there is one, is amplifying too).For now those are the only instructions for removing unnecessary characters that you have to follow (oh yes, a newline is a character, too).The input contains the text of the spell, which should be reduced. Remove the extra characters and print the result to the output.

The input contains multiple lines. All characters in the lines have codes from 32 to 127 (inclusive). Please note that the lines may begin with or end with one or more spaces. The size of the input does not exceed 1048576 ( = 220) bytes. Newlines are included in this size. In the Windows operating system used on the testing computer, a newline is a sequence of characters with codes #13#10. It is guaranteed that after each line of input there is a newline. In particular, the input ends with a newline. Note that the newline is the end of the line, and not the beginning of the next one. It is guaranteed that the input contains at least one character other than a newline. It is recommended to organize the input-output line by line, in this case the newlines will be processed correctly by the language means.

Print the text of the spell where all extra characters are deleted. Please note that each output line should be followed by a newline. Please be careful: your answers will be validated by comparing them to the jury's answer byte-by-byte. So, all spaces and newlines matter.

#   include <cstdio>

using namespace std;

int main     (   ){
puts("Hello # World"); #
#
}

#   include <cstdio>
usingnamespacestd;intmain(){puts("Hello#World");#
#
}

NoteIn the first sample the amplifying lines are lines 1 and 7. So, lines 2 to 6 are concatenated to each other, all spaces are deleted from them.In the second sample the amplifying lines are lines 1 and 3. So, no lines are concatenated to each other.

<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){

	$flag = 0;
	$fp = @fopen("input.txt", 'r');
	//file has eof,but stdin not.
	//while (!feof($fp)) {
		//$line = rtrim(fgets($fp), "\r\n");

	//STDIN is opened, so this is not needed
	//$STDIN = @fopen("php://stdin", 'r');
	while ($line = fgets(STDIN)) {
		$line = rtrim($line, "\r\n");
		$text = ltrim($line);
		if ($text[0] === "#") {
			if ($flag === 1) {
				print($replaceds."\n");
				$replaceds = "";
			}
			print($line."\n");
			$flag = 0;
		} else {
			$replaceds .= str_replace(" ", "", $text);
			$flag = 1;
		}
	}
	if ($flag === 1) {
		print($replaceds."\n");
	}
	fclose($STDIN);
}
?>

<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	$flag = 0;
	//$fp = @fopen("input.txt", "r");
	//while (!feof($fp)) {
		//$line = rtrim(fgets($fp), "\r\n");
	$STDIN = @fopen('php://stdin', 'r');
	while ($line = fgets($STDIN)) {
		$line = rtrim($line, "\r\n");
		$text = ltrim($line);
		if ($text[0] === "#") {
			if ($flag === 1) {
				print($replaceds."\n");
				$replaceds = "";
			}
			print($line."\n");
			$flag = 0;
		} else {
			$replaceds .= str_replace(" ", "", $text);
			$flag = 1;
		}
	}
	if ($flag === 1) {
		print($replaceds."\n");
	}
	fclose($STDIN);
}
?>

<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	$flag = 0;
	$STDIN = @fopen("php://stdin", 'r');
	while ($line = fgets($STDIN)) {
		$line = rtrim($line, "\r\n");
		$text = ltrim($line);
		if ($text[0] === "#") {
			if ($flag === 1) {
				print($replaceds."\n");
				$replaceds = "";
			}
			print($line."\n");
			$flag = 0;
		} else {
			$replaceds .= str_replace(" ", "", $text);
			$flag = 1;
		}
	}
	if ($flag === 1) {
		print($replaceds."\n");
	}
	fclose($STDIN);
}
?>

<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	$flag = 0;
	//$fp = @fopen("input.txt", "r");
	//while (!feof($fp)) {
		//$line = rtrim(fgets($fp), "\r\n");
	while ($line = fgets(STDIN)) {
		$line = rtrim($line, "\r\n");
		$text = ltrim($line);
		if ($text[0] === "#") {
			if ($flag === 1) {
				print($replaceds."\n");
				$replaceds = "";
			}
			print($line."\n");
			$flag = 0;
		} else {
			$replaceds .= str_replace(" ", "", $text);
			$flag = 1;
		}
	}
	if ($flag === 1) {
		print($replaceds."\n");
	}
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){

	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}

	//EOF is red ⇒ \n is needed ?
	//while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			$spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){

/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) === 5) $newlines[] = "\n";
				elseif (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
				}
				$spaces = array();
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) === 4) $newlines[] = "\n";
	elseif (count($spaces) !== 6 && count($spaces) !== 0 && count($newlines) !== 0) {		for ($j = 0; $j < $len; $j++) $newlines[] = $spaces[$j];
	} elseif (count($spaces) !== 0 && count($newlines) === 0) $newlines[] = "\n";

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			$spaces[] = "\n";
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	$handle = fopen("php://stdin");
	//$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {

		$line = fgets($handle);
	}
*/
	while($line = fgets(STDIN)) $lines[] = $line;

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		$newlines[] = $normalline;
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) {
		if ($i !== $len - 1) print($newlines[$i]);
		elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			$spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) !== 0) {
		for ($j = 0; $j < $len; $j++) {
			if ($j !== $len - 1) $newlines[] = $spaces[$j];
			else $newlines[] = $spaces[$j];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	$flag = 0;
	//$fp = @fopen("input.txt", "r");
	//while (!feof($fp)) {
		//$line = rtrim(fgets($fp), "\r\n");
	while ($line = rtrim(fgets(STDIN), "\r\n")) {
		$text = ltrim($line);
		if ($text[0] === "#") {
			if ($flag === 1) {
				print($replaceds."\n");
				$replaceds = "";
			}
			print($line."\n");
			$flag = 0;
		} else {
			$replaceds .= str_replace(" ", "", $text);
			$flag = 1;
		}
	}
	if ($flag === 1) {
		print($replaceds."\n");
	}
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\r\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			$spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) !== 0 && count($newlines) !== 0) {
		for ($j = 0; $j < $len; $j++) {
			if ($j !== $len - 1) $newlines[] = $spaces[$j];
			else $newlines[] = $spaces[$j];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) === 4) $newlines[] = "\n";
	elseif (count($spaces) !== 6 && count($spaces) !== 0 && count($newlines) !== 0) {		for ($j = 0; $j < $len; $j++) $newlines[] = $spaces[$j];
	} elseif (count($spaces) !== 0 && count($newlines) === 0) $newlines[] = "\n";

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
	//$handle = fopen("php://stdin");
	$handle = fopen(STDIN);
	//$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		$newlines[] = $normalline;
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) {
		if ($i !== $len - 1) print($newlines[$i]);
		elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
	$handle = fopen("php://stdin");
	//$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count(spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
				}
				$spaces = array();
			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$normalline .= str_replace(" ", "", rtrim($lines[$i]));
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		$newlines[] = $normalline;
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) {
		if ($i !== $len - 1) print($newlines[$i]);
		elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){

/*??
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			$spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){

/*??
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			$spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){

/*??
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n")."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			$spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
	$handle = fopen("php://stdin");
	//$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {

				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
				}
				$spaces = array();
			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		$newlines[] = $normalline;
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) {
		if ($i !== $len - 1) print($newlines[$i]);
		elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	$flag = 0;
	//$fp = @fopen("input.txt", "r");
	//while (!feof($fp)) {
		//$line = rtrim(fgets($fp), "\r\n");
	$fp = @fopen("php://stdin");
	while ($line = fgets($fp)) {
		$line = rtrim($line, "\r\n");
		$text = ltrim($line);
		if ($text[0] === "#") {
			if ($flag === 1) {
				print($replaceds."\n");
				$replaceds = "";
			}
			print($line."\n");
			$flag = 0;
		} else {
			$replaceds .= str_replace(" ", "", $text);
			$flag = 1;
		}
	}
	if ($flag === 1) {
		print($replaceds."\n");
	}
	fclose($fp);
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){

/*?
	$handle = fopen("php://stdin");
	//$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		$newlines[] = $normalline;
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) === 6) $newlines[] = "\n";
	elseif (count($spaces) !== 6 && count($spaces) !== 0 && count($newlines) !== 0) {		for ($j = 0; $j < $len; $j++) $newlines[] = $spaces[$j];
	} elseif (count($spaces) !== 0 && count($newlines) === 0) $newlines[] = "\n";

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) === 5) $newlines[] = "\n";
	elseif (count($spaces) !== 6 && count($spaces) !== 0 && count($newlines) !== 0) {		for ($j = 0; $j < $len; $j++) $newlines[] = $spaces[$j];
	} elseif (count($spaces) !== 0 && count($newlines) === 0) $newlines[] = "\n";

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) !== 0 && count($newlines) !== 0) {
		for ($j = 0; $j < $len; $j++) {
			if ($j !== $len - 1) $newlines[] = $spaces[$j];
			else $newlines[] = $spaces[$j];
		}
	} elseif (count($spaces) !== 0 && count($newlines) === 0) $newlines[] = "\n";

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}
			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}
	if (count($spaces) !== 0) {
		for ($j = 0; $j < $len; $j++) {
			if ($j !== $len - 1) $newlines[] = $spaces[$j];
			else $newlines[] = $spaces[$j]. "\n";
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	//EOF is red ⇒ \n is needed ?
	while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	//$ispower = false;
	$ispower = true;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$powerspell = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$newlines[] = $powerspell."\n";
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			//first spaces + powersell line# ⇒ this spaces is not deleteed
			//if ($ispower) $spaces[] = $lines[$i];
			//$spaces[] = $lines[$i];
			if ($ispower) $spaces[] = "\n";
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline."\n";
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	//empty line = "(\n)" or "   (\n)" and "            (\n)".so not only "(\n)"
	$line = str_replace(" ", "", $line);
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){

	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}

	//EOF is red ⇒ \n is needed ?
	//while($line = fgets(STDIN)) $lines[] = $line;

	//TLE EOF is not
	//$fp = fopen("php://stdin");
	//while (!feof($fp)) {
	//	$lines[] = fgets($fp);
	//}

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {
				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
					$spaces = array();
				}

			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		//$newlines[] = $normalline;
		$newlines[] = $normalline;
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) print($newlines[$i]);
		//if ($i !== $len - 1) print($newlines[$i]);
		//elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

define("PowerSpell", 1);
define("Space" ,0);
define("Normal" ,-1);

solve();

function solve(){
	//$handle = fopen("php://stdin");
	//$handle = @fopen("input.txt", "r");

	//$line = fgets($handle);
	$line = fgets("php://stdin");
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets("php://stdin");
	}

	$len = count($lines);
	$ispower = false;
	$newlines = array();
	$normalline = "";
	$spaces = array();
	for ($i = 0; $i < $len; $i++) {
		$type = linetype($lines[$i]);
		if ($type === PowerSpell) {
			if ($normalline !== "") {

				$newlines[] = $normalline."\n";
				$normalline = "";
			}

			if (!$ispower) $ispower = true;
			else {
				if (count($spaces) !== 0) {
					foreach ($spaces as $as_space) {
						$newlines[] = $as_space;
					}
				}
				$spaces = array();
			}
			$newlines[] = $lines[$i];
		} elseif ($type === Normal) {
			$line = rtrim(str_replace("\r\n", "\n", $lines[$i]), "\n");
			$normalline .= str_replace(" ", "", $line);
			$spaces = array();
			$ispower = false;
		} elseif ($type === Space) {
			if ($ispower) $spaces[] = $lines[$i];
		}
	}

	if ($normalline !== "") {
		$newlines[] = $normalline;
	}

	$len = count($newlines);
	for ($i = 0; $i < $len; $i++) {
		if ($i !== $len - 1) print($newlines[$i]);
		elseif ($i === $len - 1 && $newlines[$i] !== "") print(rtrim($newlines[$i]));	}
}

function linetype($line){
	$line = str_replace("\r\n", "\n", $line);
	$line = rtrim($line, "\n");

	if ($line === "") return 0;

	$elemets = str_split($line);
	$len = count($elemets);
	for ($i = 0; $i < $len; $i++) {
		if ($elemets[$i] === " ") continue;
		else {
			$first = $elemets[$i];
			break;
		}
	}
	if ($first === "#") return 1;

	return -1;
}
?>

<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){
/*
	//$handle = fopen("php://stdin");
	$handle = @fopen("input.txt", "r");

	$line = fgets($handle);
	while ($line !== false) {
		$lines[] = $line;
		$line = fgets($handle);
	}
*/
	$flag = 0;
	//$fp = @fopen("input.txt", "r");
	//while (!feof($fp)) {
		//$line = rtrim(fgets($fp), "\r\n");
	$fp = @fopen(STDIN);
	while ($line = fgets($fp)) {
		$line = rtrim($line, "\r\n");
		$text = ltrim($line);
		if ($text[0] === "#") {
			if ($flag === 1) {
				print($replaceds."\n");
				$replaceds = "";
			}
			print($line."\n");
			$flag = 0;
		} else {
			$replaceds .= str_replace(" ", "", $text);
			$flag = 1;
		}
	}
	if ($flag === 1) {
		print($replaceds."\n");
	}
	fclose($fp);
}
?>


Dreamoon likes to play with sets, integers and .  is defined as the largest positive integer that divides both a and b.Let S be a set of exactly four distinct integers greater than 0. Define S to be of rank k if and only if for all pairs of distinct elements si, sj from S, .Given k and n, Dreamoon wants to make up n sets of rank k using integers from 1 to m such that no integer is used in two different sets (of course you can leave some integers without use). Calculate the minimum m that makes it possible and print one possible solution.

The single line of the input contains two space separated integers n, k (1 ≤ n ≤ 10 000, 1 ≤ k ≤ 100).

On the first line print a single integer — the minimal possible m.  On each of the next n lines print four space separated integers representing the i-th set. Neither the order of the sets nor the order of integers within a set is important. If there are multiple possible solutions with minimal m, print any one of them.

NoteFor the first example it's easy to see that set {1, 2, 3, 4} isn't a valid set of rank 1 since .

<?php
	//God & me
	//Damned if Amirjoon doesn't take what he wants.

	$INPUTS = preg_split("/[\s]+/", file_get_contents('php://stdin'));
	function in() {
	    static $i=0;
	    global $INPUTS;
	    return $INPUTS[$i++];
	}

  $n=in();$k=in();
  echo $k * ( ($n-1) * 6 + 5 )."\n";
  for($i=1;$i<=($n-1)*6+1;$i+=6)
	  echo $k * $i . " " . $k * ($i+2) . " " . $k * ($i+3) . " " . $k * ($i+4) . "\n";

?>


The Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to n, where the main capital city has number n, and the culture capital — number 1. The road network is set up so that it is possible to reach any city from any other one by the roads. Moving on each road in any direction takes the same time.All residents of Berland are very lazy people, and so when they want to get from city v to city u, they always choose one of the shortest paths (no matter which one).The Berland government wants to make this country's road network safer. For that, it is going to put a police station in one city. The police station has a rather strange property: when a citizen of Berland is driving along the road with a police station at one end of it, the citizen drives more carefully, so all such roads are considered safe. The roads, both ends of which differ from the city with the police station, are dangerous.Now the government wonders where to put the police station so that the average number of safe roads for all the shortest paths from the cultural capital to the main capital would take the maximum value.

The first input line contains two integers n and m (2 ≤ n ≤ 100, ) — the number of cities and the number of roads in Berland, correspondingly. Next m lines contain pairs of integers vi, ui (1 ≤ vi, ui ≤ n, vi ≠ ui) — the numbers of cities that are connected by the i-th road. The numbers on a line are separated by a space.  It is guaranteed that each pair of cities is connected with no more than one road and that it is possible to get from any city to any other one along Berland roads.

Print the maximum possible value of the average number of safe roads among all shortest paths from the culture capital to the main one. The answer will be considered valid if its absolute or relative inaccuracy does not exceed 10 - 6.

NoteIn the first sample you can put a police station in one of the capitals, then each path will have exactly one safe road. If we place the station not in the capital, then the average number of safe roads will also make .In the second sample we can obtain the maximum sought value if we put the station in city 4, then 6 paths will have 2 safe roads each, and one path will have 0 safe roads, so the answer will equal .


After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit Cards.Rules of this game are simple: each player bring his favourite n-digit credit card. Then both players name the digits written on their cards one by one. If two digits are not equal, then the player, whose digit is smaller gets a flick (knock in the forehead usually made with a forefinger) from the other player. For example, if n = 3, Sherlock's card is 123 and Moriarty's card has number 321, first Sherlock names 1 and Moriarty names 3 so Sherlock gets a flick. Then they both digit 2 so no one gets a flick. Finally, Sherlock names 3, while Moriarty names 1 and gets a flick.Of course, Sherlock will play honestly naming digits one by one in the order they are given, while Moriary, as a true villain, plans to cheat. He is going to name his digits in some other order (however, he is not going to change the overall number of occurences of each digit). For example, in case above Moriarty could name 1, 2, 3 and get no flicks at all, or he can name 2, 3 and 1 to give Sherlock two flicks.Your goal is to find out the minimum possible number of flicks Moriarty will get (no one likes flicks) and the maximum possible number of flicks Sherlock can get from Moriarty. Note, that these two goals are different and the optimal result may be obtained by using different strategies.

The first line of the input contains a single integer n (1 ≤ n ≤ 1000) — the number of digits in the cards Sherlock and Moriarty are going to use. The second line contains n digits — Sherlock's credit card number. The third line contains n digits — Moriarty's credit card number.

First print the minimum possible number of flicks Moriarty will get. Then print the maximum possible number of flicks that Sherlock can get from Moriarty.

NoteFirst sample is elaborated in the problem statement. In the second sample, there is no way Moriarty can avoid getting two flicks.


It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills.According to the borscht recipe it consists of n ingredients that have to be mixed in proportion  litres (thus, there should be a1 ·x, ..., an ·x litres of corresponding ingredients mixed for some non-negative x). In the kitchen Volodya found out that he has b1, ..., bn litres of these ingredients at his disposal correspondingly. In order to correct his algebra mistakes he ought to cook as much soup as possible in a V litres volume pan (which means the amount of soup cooked can be between 0 and V litres). What is the volume of borscht Volodya will cook ultimately?

The first line of the input contains two space-separated integers n and V (1 ≤ n ≤ 20, 1 ≤ V ≤ 10000). The next line contains n space-separated integers ai (1 ≤ ai ≤ 100). Finally, the last line contains n space-separated integers bi (0 ≤ bi ≤ 100).

Your program should output just one real number — the volume of soup that Volodya will cook. Your answer must have a relative or absolute error less than 10 - 4.

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
$d = explode(" ", trim(fgets(STDIN)));
$f = array();
$g = 0;
for($x = 1; $x <= $b; $x++)
{
    for($y = 0; $y < $a; $y++)
    {
        $d[$y] -= $c[$y];
        if($d[$y] > 0)
        {
            array_unshift($f, $c[$y]);
        }
        elseif($d[$y] == 0)
        {
            array_unshift($f, $c[$y]);
            $g = 1;
        }
        elseif($d[$y] < 0)
        {
            $g = 2;
            array_unshift($f, $c[$y]);
        }
    }
    if($g == 1)
    {
        break;
    }
    elseif($g == 2)
    {
        $f = array_slice($f, $a);
        break;
    }
}
if(array_sum($f) >= $b)
{
    print number_format($b, 4, ".", "");
}
else
{
    print number_format(array_sum($f), 4, ".", "");
}
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
$d = explode(" ", trim(fgets(STDIN)));
$f = array();
$g = 0;
for($x = 1; $x <= $b; $x++)
{
    for($y = 0; $y < $a; $y++)
    {
        $d[$y] -= $c[$y];
        if($d[$y] > 0)
        {
            array_push($f, $c[$y]);
        }
        elseif($d[$y] == 0)
        {
            array_push($f, $c[$y]);
            $g = 1;
        }
    }
    if($g == 1)
    {
        break;
    }
}
if(array_sum($f) >= 100)
{
    print number_format(100, 4, ".", "");
}
else
{
    print number_format(array_sum($f), 4, ".", "");
}
?>


This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You may also refer to the guide on interactive problems: https://codeforces.com/blog/entry/45307.The jury guessed some array $$$a$$$ consisting of $$$6$$$ integers. There are $$$6$$$ special numbers — $$$4$$$, $$$8$$$, $$$15$$$, $$$16$$$, $$$23$$$, $$$42$$$ — and each of these numbers occurs in $$$a$$$ exactly once (so, $$$a$$$ is some permutation of these numbers).You don't know anything about their order, but you are allowed to ask up to $$$4$$$ queries. In each query, you may choose two indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le 6$$$, $$$i$$$ and $$$j$$$ are not necessarily distinct), and you will get the value of $$$a_i \cdot a_j$$$ in return.Can you guess the array $$$a$$$?The array $$$a$$$ is fixed beforehand in each test, the interaction program doesn't try to adapt to your queries.

NoteIf you want to submit a hack for this problem, your test should contain exactly six space-separated integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_6$$$. Each of $$$6$$$ special numbers should occur exactly once in the test. The test should be ended with a line break character.


You are given a positive integer $$$n$$$. You have to find $$$4$$$ positive integers $$$a, b, c, d$$$ such that  $$$a + b + c + d = n$$$, and $$$\gcd(a, b) = \operatorname{lcm}(c, d)$$$.If there are several possible answers you can output any of them. It is possible to show that the answer always exists.In this problem $$$\gcd(a, b)$$$ denotes the greatest common divisor of $$$a$$$ and $$$b$$$, and $$$\operatorname{lcm}(c, d)$$$ denotes the least common multiple of $$$c$$$ and $$$d$$$.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Description of the test cases follows. Each test case contains a single line with integer $$$n$$$ ($$$4 \le n \le 10^9$$$) — the sum of $$$a$$$, $$$b$$$, $$$c$$$, and $$$d$$$.

For each test case output $$$4$$$ positive integers $$$a$$$, $$$b$$$, $$$c$$$, $$$d$$$ such that $$$a + b + c + d = n$$$ and $$$\gcd(a, b) = \operatorname{lcm}(c, d)$$$.