source_code:
<?php
# 1143B
$start = microtime(true);
$arrayMultiply = function(array $arr){
    $res = 1;
    array_walk($arr, function($i) use (&$res){$res *= $i;});
    return $res;
};

$n = trim(fgets(STDIN));
$nLength = strlen($n);
if ($nLength === 1) {
    die($n);
}
if (substr($n, 1, $nLength - 1) === str_repeat('9', $nLength - 1)) {
    die((string)$arrayMultiply(str_split($n)));
}
$n = str_split($n);
$max = $arrayMultiply($n);
for ($i = 0; $i < $nLength - 1; $i++) {
    $arr = $n;
    $arr[$i] = ((int)$arr[$i]) - 1;
    for ($j = $i + 1; $j < $nLength; $j++) {
        $arr[$j] = 9;
    }
    for ($j = $nLength - 1; $j > 0; $j--) {
        if ($arr[$j] === 0) {
            $arr[$j] = 9;
            $arr[$j - 1]--;
        }
        if ($arr[$j] === -1) {
            $arr[$j] = 9;
            $arr[$j - 1]--;
        }
    }
    if ($arr[0] === 0) {
        unset($arr[0]);
    }
    $max = max($max, $arrayMultiply($arr));
}

echo $max;

lang_cluster: PHP

exec_outcome: PASSED


source_code:
<?php
list($n) = explode(' ', trim(fgets(STDIN)));
$iCount = strlen($n) == 1 ? 9 : 10;
$bFlag = strlen($n) == 1 ? true : false;
if(!$bFlag){
    foreach (str_split($n) as $sK => $sV){
        if($sK != 0){
            $iCount += 9 - $sV;
        }
    }
}

echo $iCount;


source_code:
<?php

//First Get The Input.
$input = file_get_contents("php://stdin");

$curr = $input[0];

$count = 1;

$done = false;

//Loop Throw The Input.
for($i = 1;$i < strlen($input);$i++) {

    if($input[$i] == $curr) {

        $count++;

    }else {

        $curr = $input[$i];

        if($count > 6) {

            echo "YES";

            $done = true;

            break;

        }

        $count = 1;

    }

}

if($done == false) {

    echo "NO";

}

?>


source_code:
<?php
$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));

echo (strrev($s) == $t ? "YES" : "NO");
?>


source_code:
<?php
fscanf(STDIN, "%d", $n);

if ($n % 2 === 0) {
    echo "Mahmoud";
}
else {
    echo "Ehab";
}

?>


source_code:
<?php

function debug($data, $die = true) {
    echo '<pre>';

    if (is_array($data)) {
        print_r($data);
    } else {
        var_dump($data);
    }

    if ($die) {
        die();
    }

    echo '</pre>';
}

function stdin() {
    $stdin = @fopen('data.txt', 'r');
    if (!$stdin) {
        $stdin = fopen('php://stdin', 'r');
    }

    return $stdin;
}

function g() {
    global $stdin;
    return trim(fgets($stdin));
}

$stdin = stdin();
/****************************************************** Solving block *****************************************************/
$id = g();

$word = "[a-z0-9_]{1,16}";
$correct = preg_match("/^$word@(($word\.)*$word)(\/$word)?$/i", $id, $matches);
$correct = $correct && strlen($matches[1]) && strlen($matches[1]) < 33;

echo $correct ? 'YES' : 'NO';

?>


source_code:
<?php
// 450A     Jzzhu и дети
$in = fopen("php://stdin", 'r');

//$input_line = fgets($in);
//$n = (int) $input_line;

$input_line = fgets($in);
list($n, $m) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);
$n = (int) $n;
$m = (int) $m;

$input_line = fgets($in);
$arr = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

while (count($arr) > 0) {
    foreach ($arr as $key => &$value) {
        $number = $key + 1;
        $value -= $m;
        if ($value <= 0) unset($arr[$key]);
    }
    unset($value);
}

echo "$number\n";

?>


source_code:
<?php
while($s = fgets(STDIN)){
    $input .= $s;
}

$directory = '/';
$input = explode("\r\n", $input);
$s = $input[0];
/*/
$s = 'oOPS';
//*/

if(preg_match('/^([a-z]|[A-Z])([A-Z]+)?$/', $s, $tmp)) {
    $s = strtolower($s);
    if($s[0] == $tmp[1]) {
        $s[0] = strtoupper($s[0]);
    }
}
echo $s;


source_code:
<?php
$wWeight = 0;
$bWeight = 0;
for($i=0; $i < 8; $i++){
    $line[$i] = trim(fgets(STDIN));
    for($j=0; $j < 8; $j++){

        if($line[$i][$j] == 'Q'){
            $wWeight = $wWeight + 9;
        }
        if($line[$i][$j] == 'R'){
            $wWeight = $wWeight+ 5;
        }
        if($line[$i][$j] == 'B' or $line[$i][$j] == 'N'){
            $wWeight = $wWeight + 3;
        }
        if($line[$i][$j] == 'P'){
            $wWeight++;
        }

        if($line[$i][$j] == 'q'){
            $bWeight = $bWeight + 9;
        }
        if($line[$i][$j] == 'r'){
            $bWeight = $bWeight + 5;
        }
        if($line[$i][$j] == 'b' or $line[$i][$j] == 'n'){
            $bWeight = $bWeight + 3;
        }
        if($line[$i][$j] == 'p'){
            $bWeight++;
        }

    }
}

if($wWeight > $bWeight){
    echo "White";
}
if($wWeight < $bWeight){
    echo "Black";
}
if($wWeight == $bWeight){
    echo "Draw";
}


source_code:
<?php
$input = rtrim(fgets(STDIN));
$input2 = rtrim(fgets(STDIN));
$cmp= strcmp(strtolower($input),strtolower($input2));
if($cmp==0){
  echo 0;
}else if($cmp<0){
  echo -1;
}else{
  echo 1;
}


source_code:
<?php
$input = fgets(STDIN);
$res= ($input + 1)/2;
if ($res%2 == 0) {
    echo 0;
} else {
    echo 1;
}


source_code:
<?php
$number = fgets(STDIN);
$number = trim($number);

$counter = 0;

for ($i=0; $i < strlen($number); $i++) {
	if(($number[$i] == "4") || ($number[$i] == "7")){
		$counter++;
	}

}

if($counter == strlen($number)){
		echo "YES";
		exit();
	} elseif(intval($number) % 4 == 0) {
		echo "YES";
		exit();
	} elseif(intval($number) % 7 == 0) {
		echo "YES";
		exit();
	} elseif(intval($number) % 47 == 0) {
		echo "YES";
	} elseif(intval($number) % 74 == 0) {
		echo "YES";
	} else {
		echo "NO";
		exit();
	}


source_code:
<?php

$n = (int) readline();
$str = readline();
$ans1 = $ans = 0;
$lnth = strlen($str);
for($i=0; $i<$lnth-1; $i++)
{
	if($str[$i]=="S" and $str[$i+1]=="F")  $ans++;
	elseif ($str[$i]=='F' and $str[$i+1]=='S')  $ans1++;
}
echo ($ans>$ans1) ? "YES" : "NO" ."\n";


source_code:
<?php
$input = trim(fgets(STDIN));
$input = explode(' ',$input);
$difColor = min($input[0],$input[1]);
$oneColor = floor((max($input[0],$input[1])-$difColor)*0.5);
fwrite(STDOUT,$difColor.' '.$oneColor);
?>


source_code:
<?PHP
    $a = fgets(STDIN);
    echo $a+$a/2;
?>


source_code:
<?php
$n = trim(fgets(STDIN));
$as = trim(fgets(STDIN));
$an = explode(" ", $as);
$as = str_replace(" ", "  ", $as);
$as = " " . $as . " ";
$p = 1;
for ($i = 0; $i < $n; $i++) {
    $q = substr_count($as, " " . $an[$i] . " ");
    if ($q > $p) {
        $p = $q;
    }
}
print $p;


source_code:
<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = $a - $b;
$d = $b - 1;
if($c <= $d)
{
     if($b - 1 == 0)
     {
          print "1";
     }
     else
     {
          print $b - 1;
     }
}
else
{
     print $b + 1;
}
?>


source_code:
<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
$d = array_reverse($c);
$e = array_fill(0, $a, 0);
for($x = 0; $x < $b; $x++)
{
    for($y = $d[$x] - 1; $y < $a; $y++)
    {
        $e[$y] = $d[$x];
    }
}
print implode(" ", $e);
?>


source_code:
<?php

	$stdin = fopen('php://stdin', 'r');
   $string = trim(fgets($stdin));
  $arr = explode(" ", $string);
  rsort($arr);

  echo ($arr[0] - $arr[2]);


source_code:
<?php
	$n = fgets(STDIN);
	$n = (int)$n;
	$a = array();
	for($i = 0; $i<$n; $i++){
	    $a[$i] = trim(fgets(STDIN));
	}
    $sum = 0; $k = 0;

    if(fun($a, $n, $sum, $k)){
       echo  "YES";
    } else {
        echo "NO";
    }

    function fun(&$p, $n, $sum, $i){
        if($i == $n){
            return $sum%360==0;
        }
        return fun($p, $n, $sum+$p[$i], $i+1) || fun($p, $n, $sum-$p[$i], $i+1) ;
    }

?>


source_code:
<?php
function try_digit($d) {
    if ($d == 0) printf ("O-|-OOOO\n");
    if ($d == 1) printf ("O-|O-OOO\n");
    if ($d == 2) printf ("O-|OO-OO\n");
    if ($d == 3) printf ("O-|OOO-O\n");
    if ($d == 4) printf ("O-|OOOO-\n");
    if ($d == 5) printf ("-O|-OOOO\n");
    if ($d == 6) printf ("-O|O-OOO\n");
    if ($d == 7) printf ("-O|OO-OO\n");
    if ($d == 8) printf ("-O|OOO-O\n");
    if ($d == 9) printf ("-O|OOOO-\n");
}
fscanf(STDIN, "%d", $n);
if ($n == 0) try_digit(0);
else {
    while ($n >= 1) {
        try_digit($n % 10);
        $n = (int) $n / 10;
    }
}
?>


source_code:
<?php

list($a,$b,$s)=fscanf(STDIN,"%d %d %d");

$dist=abs($a)+abs($b);
$gap=$s-$dist;
if($gap>=0&&$gap%2==0)    echo "YES\n";
else    echo "NO\n";

?>


source_code:
<?php
    $fp = fopen('php://stdin', 'r');
    $n = rtrim(fgets($fp));
    $input = rtrim(fgets($fp));
    if(preg_match('/[^47]/', $input)) {
        echo 'NO';
    }else {
        $input = array_chunk(str_split($input), $n / 2);
        echo (array_sum($input[0]) == array_sum($input[1])) ? 'YES' : 'NO';
    }
?>


source_code:
<?php
	$deposite = fgets(STDIN);
	if($deposite >= 0)
		echo $deposite;
	else
		echo max($deposite, ceil($deposite / 10), ceil($deposite / 100) * 10 + $deposite % 10);


source_code:
<?php
/*****************************************/
class InputReader {protected $_fh;public function __construct($fileHandler = STDIN){$this->_fh = $fileHandler;}
	public function readInt() {$d = trim(fgets($this->_fh));return (int)$d;}
	public function readArrayOfInt($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = (int)$item;}return $a;}
	public function readArrayOfString($size, $indexFrom = 0) {$a = [];$ind = $indexFrom;foreach (explode(' ', fgets($this->_fh)) as $item) {$a[$ind++] = $item;}return $a;}
}

class Utils {
	/* Perform action N times. Can return values in array */
	static public function ntimes($n, $func, $returnResults = false) {$a = [];for ($i=1; $i<=$n; $i++) {$result = $func();if ($returnResults) {$a[$i] = $result;}}return $a;}
	/* Integral. Keys preserved. By reference. */
	static public function cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}
	/* Difference. Keys preserved. By reference. */
	static public function diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}
	static public function bitCount($n){$cnt = 0;for ($j=$n; $j; $j>>=1){$cnt += $j&1;}return $cnt;}
}

class PrimeUtils {static protected $divisors = [1 => [1=>true],2 => [1=>true, 2=>true],];static protected $primes = [];
	static public function primes($limit){$a = str_repeat(chr(85), ($limit>>3) + 1);$a[0] = chr(83);for ($i=3; $i*$i < $limit; $i+=2) {if (ord($a[$i>>3]) & (1<<($i%8))) {;} else {for ($k=$i; $k*$i<$limit; $k++) {$n = $k*$i;$a[$n>>3] = chr(ord($a[$n>>3]) | (1<<($n%8)));}}}yield 2;for ($i=3; $i<$limit; $i+=2) {if (!(ord($a[$i>>3]) & (1<<($i%8)))) {yield $i;}}}
	static public function divisors($n, $lp = 2) {if (isset(self::$divisors[$n])) {return self::$divisors[$n];}if (empty(self::$primes)) {$primes = [];foreach (self::primes(1e3) as $prime) {$primes[$prime] = $prime;}self::$primes = $primes;}$r = [];foreach (self::$primes as $p) {if ($p>=$lp) {if ($n < $p*$p) {$r = [1=>true, $n=>true];break;} elseif ($n%$p==0) {foreach([1, $p] as $pre) {foreach(self::divisors(intdiv($n,$p), $p) as $nxt=>$v) {$r[$nxt*$pre] = true;}}break;}}}self::$divisors[$n] = $r;return self::$divisors[$n];}
}

/*****************************************/

$ir = new InputReader();

/* TASK */

list($n, $k) = $ir->readArrayOfInt(2);
$xs = [];
foreach(PrimeUtils::divisors($n) as $divisor=>$v) {
	$l = $divisor;
	$m = intval($n/$l);
	//echo "$divisor, $l, $m, $k\n";

	if ($m<$k) {
		$xs[] = $k*$l + $m;
	}
}

if (empty($xs)) {
	echo $n*$k+1;
} else {
	echo min($xs);
}


source_code:
<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
rsort($b);
$c = array();
$d = array();
for($x = 0; $x < $a; $x++)
{
     if($b[$x] > 0)
     {
          $c[count($c)] = $b[$x];
     }
     else
     {
          $d[count($d)] = $b[$x];
     }
}
$e = array_sum($c);
$f = array_sum($d);
$g = $e - $f;
print $g;
?>