<?php
fscanf(STDIN,"%d %d %d",$participate,$pens,$notebook);
if($pens>=$participate&&$notebook>=$participate)
	echo "Yes";
else
	echo "No";


<?php

while(! feof(STDIN)){
    $arr[]=fgets(STDIN);
}
$value=explode(" ", $arr[0]);

$value[2]-=0;
if($value[0]<=$value[1] && $value[0]<=$value[2]) echo "Yes";
else echo "No";

?>


<?php
$input=fgets(STDIN);
$input=str_replace('WUB',' ',$input);
$input=str_word_count($input,1);
echo implode(' ',$input);
?>


<?php print trim(str_replace('WUB',' ',fgets(STDIN))); ?>


<?php
/*RH*/

$T=str_split(trim(fgets(STDIN)));
$magic=0;

	foreach($T as $spell)
			{
			if($spell==4 or $spell==7)
			$magic++;
			}
			if($magic==4 or $magic==7)
			echo "YES";
			else
			echo "NO";
?>


<?php
fscanf(STDIN, "%s",$s);
$correct = Array(4,7);
for($i=0;$i<strlen($s);$i++)
  in_array((int)$s[$i], $correct)?$cnt++:"";
echo in_array($cnt, $correct)?"YES":"NO";
?>


<?php
$n = explode(" ", trim(fgets(STDIN)));
sort($n);
if ($n[0] % 2 == 0)
    echo "Malvika";
else
    echo "Akshat";
?>


<?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;


<?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;


<?php

list($spots, $height, $r) = explode(' ', trim(fgets(STDIN)));
$zone = array_fill(0, ($spots), (int)$height);

/*
3 3 3
1 1 1
2 2 3
3 3 2
*/
while( $line = trim(fgets( STDIN )) ) {
	list($start, $stop, $rr) = explode(' ', $line);
	for(;$start <= $stop; $start++) {
		$zone[($start - 1)] = min($rr, $zone[($start - 1)]);
	}
}

$max = 0;
for($i = 0; $i < sizeof($zone); $i++) {
	$max += pow($zone[$i], 2);
}
echo $max;


<?php
# 1162A

[$houseAmount, $maxHeight, $limitsCount] = fscanf(STDIN, '%d %d %d');
$profitList = array_fill(0, $houseAmount, $maxHeight * $maxHeight);
for ($i = 0; $i < $limitsCount; $i++) {
    [$houseIndex, $endHouseIndex, $limit] = fscanf(STDIN, '%d %d %d' . PHP_EOL);
    $profit = $limit * $limit;
    for ($j = $houseIndex - 1; $j < $endHouseIndex; $j++) {
        $profitList[$j] = min($profitList[$j], $profit);
    }
}
echo array_sum($profitList);


<?php

$flag = 1; //must be not zero for STDIN
$in = 'php://stdin';
if (!$flag)
{
    $in = "input.txt";
}
$fd = fopen($in, "r");
fscanf($fd, "%d %d\n", $n, $k);
$data = fgets($fd);
$grade = explode(" ", $data);
fclose($fd);

for ($c = 0, $result = 0; $c < $n; $c++)
{
    $grade[$c] = intval($grade[$c]);
}
rsort($grade);
$limit = $grade[$k - 1];

for ($c = 0, $result = 0; $c < $n; $c++)
{
    if ($grade[$c] >= $limit)
    {
        {
            if ($grade[$c] > 0)
            {
                $result++;
            }
        }
    }
}
print "$result";
?>


<?php
  $input = dataProvider::get();
  $i = 0;
  foreach($input['results'] as $result) {
      if ((int) $result > 0 && (int) $result >= (int) $input['results'][$input['k'] - 1]) {
          $i++;
      } else {
          break;
      }
  }
  dataProvider::set($i);

  class dataProvider
  {
      public static function get()
      {
          $stdin = file_get_contents('php://stdin');
          $lines = explode("\n", $stdin, 2);
          $lines[0] = explode(' ', $lines[0], 2);
          $lines[1] = explode(' ', $lines[1]);
          return array(
            'n' => intval($lines[0][0]),
            'k' => intval($lines[0][1]),
            'results' => $lines[1],
          );
      }

      public static function set($data)
      {
        file_put_contents('php://stdout', $data);
      }
  }
?>


<?php
list($a, $b, $n) = explode(' ', trim(fgets(STDIN)));

$k = $a;
$nn = $n;
$sem = true;

while ($n > 0)
{
    while ($k != $n)
    {
        if ($k > $n)
            $k -= $n;
        else
            $n -= $k;
    }

    if ($sem)
    {
        $sem = false;
        $k = $b;
    }
    else
    {
        $sem = true;
        $k = $a;
    }

    $n = $nn - $n;
    $nn = $n;
    if ($n <= 0)
    {
        switch ($sem)
        {
            case true:
                echo "1";
                break;
            case false:
                echo "0";
                break;
        }
        break;
    }
}
?>


<?php
list($oneshovel, $coin)=explode(" ", trim(fgets(STDIN)));
$x=1;
while (TRUE) {

     if (($oneshovel * $x) % 10 == 0 or (($oneshovel * $x) - $coin) % 10 == 0) {

          break;
     }else $x++;

}
echo $x;
?>


<?php

$in = fopen('php://stdin', 'r');

list($n,$d) = explode(" ", rtrim(fgets($in)));
$a = explode(" ", rtrim(fgets($in)));

$s = (($n-1)*10)+array_sum($a);
if($s>$d){
    echo "-1";
}else{
    $j = floor(($d-$s)/5) + ($n-1)*2;
    echo "$j";
}


<?php

$f = fopen ("php://stdin", 'r' ) ;
$lines = file("php://stdin");

function parseint($n){
    return(intval($n));
}

$n_time = array_map("parseint", explode(" ",(strval($lines[0]))));
$n = $n_time[0];
$times = $n_time[1];

$t = array_map("parseint", explode(" ",(strval($lines[1]))));

$song_duration = array_sum($t) + (10 * ($n - 1));
if($song_duration > $times){
    print "-1" ;

}
else{
    print intval(($times - array_sum($t))/5);
}

?>


<?php
$length = (int) trim(fgets(STDIN));
$steps = [5, 4, 3, 2, 1];

$total = 0;
foreach ($steps as $step) {
    if ($length < $step) continue;
    $temp = $length % $step;
    $total = $total + ($length - $temp)/$step;
    $length = $temp;
}
echo $total;


<?php

$number = (int)fgets(STDIN);
print_r(intdiv($number, 5) + ($number % 5 == 0 ? 0 : 1));


<?php
list($num, $k) = fscanf(STDIN, "%d %d");
for ($i = 0; $i < $k; ++$i) {
  $num % 10 ? --$num : $num = intdiv($num, 10);
}
printf("%d", $num);


<?php
	$jlh = trim(fgets(STDIN));
	$str = str_split(trim(fgets(STDIN)));
	$hps = 0;
	$i = 1;
	while($i < $jlh)
	{
		if($str[$i-1] == $str[$i])
			$hps = $hps + 1;
		$i++;
	}
	echo $hps;
?>


<?php
function findOne($matrix) {
    for($i = 0; $i < 5; $i++) {
        for ($j = 0; $j < 5; $j++) {
            if ($matrix[$i][$j] == 1) return array('x' => $i, 'y' => $j);
        }
    }

    return false;
}

$matrix = array();
for ($i = 0; $i < 5; $i++) {
    $matrix[$i] = explode(' ', fgets(STDIN));
}

$point = findOne($matrix);

echo abs($point['x'] - 2) + abs($point['y'] - 2);


<?php

	$string = trim(fgets(STDIN));

	$string = str_replace('+','',$string);

	$string = str_split($string);

	$result = "";

	sort($string);

	foreach ($string as $element) {

		$result .= "+{$element}";
	}

	$result = trim($result,'+');

	echo $result;

	?>


<?php
$a = explode("+", trim(fgets(STDIN)));
sort($a);
print implode("+", $a);
?>


<?php
# Alireza
# JAHANI
# PH_PY_LA
# Dont Repeat Your self ...

$input = str_split(trim(fgets(STDIN)));
$alpha = range('a','z');
$alpha = array_flip($alpha);
$s = 0 ;

for ($i=0;$i<count($input)-1;$i++) {
      $a = abs($alpha[$input[$i]] - $alpha[$input[$i+1]]);
      $b =26 - $a ;
      $s += min($a,$b);
}
$a = abs($alpha[$input[0]] - $alpha['a']);
$b =26 - $a ;
echo $s+min($a,$b);


<?php
$n=trim(fgets(STDIN));
$n=explode(' ',$n);
$input=trim(fgets(STDIN));
$array=str_split($input);
$a=$n[1];
while($a>=1){
foreach ($array as $key => $value) {
   if(key_exists($key+1,$array)){
      if($value == 'B' and $array[$key+1] == 'G'){
      $x=$array[$key];
      $array[$key]=$array[$key+1];
      $array[$key+1]=$x;
      }
   }
}
$a--;
}
echo join('',$array);


<?php
$data = rtrim(fgets(STDIN));
$uniqued = count_chars($data, 3);// return string(5) "abfor"
$count = strlen($uniqued);
if($count%2==0){
    echo "CHAT WITH HER!";
}else {
    echo "IGNORE HIM!";
}


<?php
fscanf(STDIN, '%s', $s);

function getAlfaArray() {
    $arr = array();
    for ($i = 0; $i < 26; ++$i) {
        $arr[$i] = 0;
    }
    return $arr;
}

$alfa = getAlfaArray();
$count = 0;
$length = strlen($s);
for ($i = 0; $i < $length; ++$i) {
    if ( !$alfa[ord($s[$i]) - ord('a')] ) {
        $count++;
        $alfa[ord($s[$i]) - ord('a')] = 1;
    }
}

echo ($count % 2) ? 'IGNORE HIM!' : 'CHAT WITH HER!';


<?php
	$word = trim(fgets(STDIN));
	$counter = 0;
	foreach (str_split($word) as $i)
		if (ctype_upper($i))
			$counter++;
	fwrite(STDOUT,($counter > (strlen($word)/2))? strtoupper($word) : strtolower($word));


<?php

$s = trim(fgets(STDIN));
if(preg_match_all('/[a-z]/',$s,$o)>=preg_match_all('/[A-Z]/',$s,$o))
 print strtolower($s); else print strtoupper($s);

?>


<?php
error_reporting(E_ALL);
ini_set("memory_limit", "256M");
ini_set("max_execution_time", 1);

$fd     = fopen("php://stdin", 'r');
$count  = (int) fgets($fd);
$groups = explode(" ", trim(fgets($fd)));

$sum = 0;
foreach ($groups as $group) {
    $sum += $group;
}

echo $sum / $count;


<?php

list($a, $b) = explode(' ', readline());

$one = explode(' ', readline());
$two = explode(' ', readline());

for($i=0; $i<$a; $i++)
	for($j=0; $j<$b; $j++)
		if($one[$i] == $two[$j])
			echo $one[$i]. " ";


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
$d = explode(" ", trim(fgets(STDIN)));
$e = array();
for($x = 0; $x < $b; $x++)
{
     $e[$d[$x]] = 1;
}
$f = array();
for($x = 0; $x < $a; $x++)
{
     if($e[$c[$x]] == TRUE)
     {
          $f[count($f)] = $c[$x];
     }
}
print implode(" ", $f);
?>


<?php
fscanf(STDIN, "%d %d",$m,$n);
$r=floor($m*$n/2);
echo $r;


<?php
	$str = trim(fgets(STDIN));
	$nilai = explode(" ",$str);
	echo floor(intval($nilai[0])*intval($nilai[1])*0.5);
?>


<?php
    $stdin = fopen('php://stdin', 'r');
    $stdout = fopen('php://stdout', 'w');
    $matrix[0] = fgets($stdin);
    $matrix[1] = fgets($stdin);
    $matrix[2] = fgets($stdin);

    function illegal(){
        fputs(fopen('php://stdout', 'w'), "illegal");
        exit();
    }

    function checkingForWinner($matr, $nulls, $crosses){
        $won = null;

        for($i=0; $i<3; ++$i){
            if(($matr[$i][0]==$matr[$i][1])&&($matr[$i][1]==$matr[$i][2])){
                if($matr[$i][0]==".") continue;

                if($won != null) illegal();
                $won = $matr[$i][0]=="X" ? "first" : "second";

                if(($won=="first")&&($nulls == $crosses)) illegal();

                else if(($won=="second")&&($nulls < $crosses)) illegal();
            }
        }

        if($won!=null){
            fputs(fopen('php://stdout', 'w'), "the " . $won . " player won");
            exit();
        }
    }

    //Checking for legacy
    $nulls = 0;
    $crosses = 0;
    $reversed = array();

    for($i=0; $i<3; ++$i){
        for($j=0; $j<3; ++$j){
            if($matrix[$i][$j] == "0") $nulls++;
            else if($matrix[$i][$j] == "X") $crosses++;

            $reversed[$j][$i] = $matrix[$i][$j];
        }
    }

    if(($crosses - $nulls != 1)&&($crosses - $nulls != 0)) illegal();

    checkingForWinner($matrix, $nulls, $crosses);
    checkingForWinner($reversed, $nulls, $crosses);

    //checking the crosses for winner
    if(((($matrix[0][0]==$matrix[1][1])&&($matrix[1][1]==$matrix[2][2]))||
    (($matrix[0][2]==$matrix[1][1])&&($matrix[1][1]==$matrix[2][0])))
            &&($matrix[1][1]!=".")){

        $won = $matrix[1][1]=="X" ? "first" : "second";

        if(($won == "first")&&($nulls == $crosses)) illegal();

        else if(($won=="second")&&($nulls < $crosses)) illegal();

        fputs($stdout, "the " . $won . " player won");
        return;
    }

    if($nulls + $crosses > 8) {
        fputs($stdout, "draw");
        return;
    }

    if($crosses > $nulls) {
        fputs($stdout, "second");
    } else {
        fputs($stdout, "first");
    }
?>


<?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";

}

?>


<?php

$main = new MainClass;

fscanf(STDIN, "%d", $n);

echo $main->solution($n);
// End of interface

class MainClass {
	//996-A. Hit the Lottery
	public $problemLink = 'https://codeforces.com/problemset/problem/996/A';
	public $submissionLink = '';

	public function solution($n){
		$denominations = [1, 5, 10, 20, 100];
		$res = 0;
		$remainder = $n;
		foreach (array_reverse($denominations) as $value){
			$intQuotient = intval($remainder/$value);
			$currentReminder = $remainder % $value;
			if ($intQuotient > 0){
				$res = $res + $intQuotient;
			};
			if ($currentReminder >= 0){
				$remainder = $currentReminder;
			}
		}
		return $res;
	}
}


<?php
    list($a, $b) = explode(' ', trim(fgets(STDIN)));

    $x = log($b/$a, 1.5);
    if ($x == ceil($x)) {
        $x = ceil($x) + 1;
    } else {
        $x = ceil($x);
    }

    echo $x;


<?php
function ab($a, $b){
    $year = 0;
    while($a<=$b){
        $a=3*$a;
        $b=2*$b;
        $year++;
    }
    return $year;
}
$ab = explode(" " , trim(fgets(STDIN)));
echo ab($ab[0],$ab[1]);
?>


<?php
list($a, $b, $c, $d, $e) = explode(" ", trim(fgets(STDIN)));
$f = ($a * $b) + ($d * 2);
$g = ($a * $c) + ($e * 2);
if($f > $g)
{
     print "Second";
}
elseif($f == $g)
{
     print "Friendship";
}
elseif($f < $g)
{
     print "First";
}
?>


<?php

###### IO ######
error_reporting(E_ALL);
#error_reporting(0);

function readString($f) {
	$r = array(
		"\r" => '',
		"\n" => '',
	);
	return strtr(fgets($f), $r);
}

function readNumString($f) {
	return trim(fgets($f));
}

function stringToArray($str) {
	return str_split($str);
}

function readNum($f, $is_int = false) {
	$v = readNumString($f);
	return $is_int ? intval($v) : floatval($v);
}

function readStringExplode($f, $delimiter = ' ') {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = 'trim';
	return array_map($callf, $return);
}

function readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = $is_int ? 'intval' : 'floatval';
	return array_map($callf, $return);
}

function readNumArray($f) {
	return readStringExplodeNum($f, ' ', true);
}

function readArray($f) {
	return readStringExplodeNum($f, ' ');
}

function readTrimString($f) {
	return trim(readString($f));
}

###### /IO ######
# for($i=0;$i<$n;$i++)

function getAnswer($is_test = false, $f = false) {
	if ($is_test === false) {
		$f = STDIN;
	}
	/* begin body */
	list($s, $v1, $v2, $t1, $t2) = array_map('trim', readStringExplode($f, ' '));
	$answer1 = $t1 * 2 + $v1 * $s;
	$answer2 = $t2 * 2 + $v2 * $s;
	if ($answer1 < $answer2) {
		echo 'First';
	} elseif ($answer1 > $answer2) {
		echo 'Second';
	} else {
		echo 'Friendship';
	}

	/* / end body */
}

if (!isset($is_test)) {
	$is_test = false;
}
if (empty($is_test)) {
	getAnswer();
}


<?php
/*****************************************/
class InputReader {protected $_fh;public function __construct($fileHandler = STDIN){$this->_fh = $fileHandler;}
	public function readString() {$d = trim(fgets($this->_fh));return $d;}
	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 */

$n = $ir->readInt();
$s = $ir->readString();

$t = [];
$i = 0;
$k = 1;
while ($i<$n) {
	$t[] = $s[$i];
	$i+=$k;
	$k+=1;
}

echo implode('', $t);


<?php

$len = readline();
$str = readline();

$temp = 0;
$ans = null;

for($i = 0; $temp < (int) $len; $temp += $i) {
    $ans .= $str[$temp];
    $i++;
}

echo $ans."\n";


<?php

class Resolver
{
    /**
     * @param int $n
     * @return int
     */
    public static function resolve(int $n) : int
    {
        if ($n == 0) {
            return 1;
        }

        switch ($n % 4) {
            case 1:
                return 8;
            case 2:
                return 4;
            case 3:
                return 2;
            case 0:
                return 6;
        }
    }
}

$input = fopen("php://stdin", 'r');
$n = intval(fgets($input));
fclose($input);

echo Resolver::resolve($n);


<?php

$f = fopen('php://stdin', 'r');
//$f = fopen('1.txt', 'r');
$s = trim(fgets($f));

if (strpos($s,"H")===false && strpos($s,"Q")===false && strpos($s,"9")===false){
    echo "NO";
} else echo "YES";


<?php

$input = file_get_contents("php://stdin");

$input = str_split($input);

function doo ($in) {

    for($i = 0;$i < count($in);$i++) {

        if(in_array($in[$i],array('H','9','Q'))) {

            echo "YES";
            return;

        }

    }

    echo "NO";

}

doo($input);

?>


<?php
    $n = trim(fgets(STDIN));
    echo interes($n);
    function interes($n) {
        if (array_sum(str_split($n))%4 == 0) {
            return $n;
        } else {
            return interes($n + 1);
        }
    }

?>


<?php
    $wt = (int)fgets(STDIN);

    if(($wt%2 == 0) && ($wt > 2))
        echo "YES"."\n";
    else
        echo "NO"."\n";
?>


<?php
$son  = trim(fgets(STDIN));
echo ($son % 2) === 0 && $son > 2 ? 'YES' : 'NO';


<?php
list($sn, $sm, $sa) = explode(" ", trim(fgets(STDIN)));
print number_format(ceil($sn/$sa) * ceil($sm/$sa), 0, '', '');
?>


<?php
error_reporting(0);
$dir = fopen("php://stdin", 'r');
$datatxt = stream_get_contents($dir);
$text = explode(" ",$datatxt);
$file = ceil($text[0]/$text[2])*ceil($text[1]/$text[2]);
echo str_replace(",","",number_format($file,0));
?>


<?php
    $storeStr = (string)readline();
    $storeInt = (int)$storeStr;
    $arrayStore = str_split($storeStr);
    $findEight = false;
    $count = 0;

    while(!$findEight) {
        if (!$findEight) {
            $storeInt++;
            $storeStr = (string)$storeInt;
            $arrayStore = str_split($storeStr);
            $count++;
        }

        foreach ($arrayStore as $number) {
            if ($number === '8') $findEight = true;
        }
    }

    echo $count;
?>


<?php

$file = STDIN;
//$file = fopen('giga','r');

$s = trim(fgets($file));

for($i=0;$i<=21;$i++){

    $s++;
    if (strpos($s, '8')!==false){
        echo ($i+1);
        break;
    }
}


<?php
list($a, $b, $c) = explode(" ", trim(fgets(STDIN)));
$answer = "No";

$na = ceil($c / $a);

if ( ($c%$a == 0) || ($c%$b == 0) ) {
	$answer = "Yes";
} else {
	for ($i=0; $i < $na; $i++) {
		if ( ($c-$i*$a) % $b == 0 ) {
			$answer = "Yes";
			break;
		}
	}
}
print $answer;
?>


<?php
$year = readline("Enter:");
$yearInt = intval($year);

for($i = 0;$i < 9000;$i++){
	$yearInt++;

	$arr  = array_map('intval', str_split($yearInt));
	$arrUnique = array_unique($arr);

	if($arr == $arrUnique){
		echo $yearInt;
		break;
	}
}


<?php

	function process($n, $m, $a, $b){
		$one_ride = $n * $a;
		$multi_ride = 0;
		$half_multi_ride = (((int)($n/$m))*$b);
		$other_half_one = $a *($n%$m);
		$other_half_two = $b;
		if((int)($n/$m) != 0){
			if($n%$m != 0){
				if($half_multi_ride+$other_half_one > $half_multi_ride+$other_half_two)
					$multi_ride = $half_multi_ride+$other_half_two;
				else
					$multi_ride = $half_multi_ride+$other_half_one;
			}else{
				$multi_ride = ((int)($n/$m))*$b;
			}
		}else{
			$multi_ride = $b;
		}
		if($one_ride > $multi_ride)
			return $multi_ride;
		else
			return $one_ride;
	}

	$handle = fopen("php://stdin", 'r');
	$readAll = stream_get_contents($handle);
	$contents = explode(' ', $readAll);
	echo process($contents[0], $contents[1], $contents[2], $contents[3]);

?>


<?php
fscanf(STDIN, "%d %d %d %d", $n, $m, $a, $b);

$sisa = floor($n / $m);
$ride = $sisa * $m;
$rubles = ($sisa * $b) + (($n - $ride)*$a);

$rubles2 = ($sisa + 1) * $b;

$rubles3 = $n * $a;
echo min ($rubles, $rubles2, $rubles3);
?>


<?php
$F = fopen('php://stdin', 'r');
$n = fgets($F);
$s = fgets($F);
fclose($F);

echo preg_replace('/ogo(go)*/', '***', $s);

?>


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

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


<?php
	$n = trim(fgets(STDIN));
	$str = strtoupper(trim(fgets(STDIN)));
	$A = ord("A");
	for ($i = 0; $i < 26; $i++) {
		if (strpos($str, chr($A + $i)) === false) {
			echo "No\n";
			exit();
		}
	}
	echo "Yes\n";
?>


<?php
    fscanf(STDIN, "%d", $n);
    fscanf(STDIN, "%s", $arr);
    $v = array();
    $arr = strtolower($arr);
        for ($i = 0; $i < $n; $i++){
            $v[$arr[$i]] = 1;
        }
        if (count($v) == 26){
            echo 'YES';
        }
        else echo 'NO';


<?php

$n = trim(fgets(STDIN));
$arr = explode(" ", trim(fgets(STDIN)));

sort($arr);
$s=0;
for($i=0;$i<$n;$i++){
    if($s*$arr[$i]+$s<=$i)$s++;

}

echo $s.PHP_EOL;


<?php
/*
 * Secdra @2020
 */

fscanf(STDIN, "%s", $encrypted_pass);
$decrypted_pass = str_split($encrypted_pass,10);
for ($i = 0; $i < 10; $i++) {
    fscanf(STDIN, "%s", $code);
    $decrypted_pass = str_replace($code, $i, $decrypted_pass);
}
printf("%s", implode('', $decrypted_pass));


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

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

?>


<?php
$a = trim(fgets(STDIN));
if($a&1) print "Ehab";
else print "Mahmoud";
?>


<?php
$result = array('Sheldon', 'Leonard', 'Penny', 'Rajesh', 'Howard');
$w = intval(trim(fgets(STDIN)))-1;
$max = 0;
$last = 0;
$i = 0;
while(1) {
    $max = 5 * pow(2, $i)+$last;
    if($max > $w) {
        break;
    }
    $last = $max;
    $i++;
}
$t1 = $w - $last;
$t3 = floor($t1/pow(2,$i));
echo( $result[$t3] );


<?php

$flag = 1; //must be not zero for STDIN
$in = 'php://stdin';
if (!$flag)
{
    $in = "input.txt";
}
$fd = fopen($in, "r");
fscanf($fd, "%d\n", $n);
fclose($fd);

$names = array("Sheldon", "Leonard", "Penny", "Rajesh", "Howard");
for ($c = 0, $l = 0; $l < $n; $c++)
{
    $l = 5 * pow(2, $c + 1) - 5;
}
$c--;
$f = 5 * pow(2, $c) - 5;
$d = $n - $f;
$div = pow(2, $c);
$r = ceil($d / $div);
$r--;
print $names[$r] . "\n";
?>


<?php
/**
 * Preparing Olympiad
 *
 * http://codeforces.com/contest/550/problem/B
 *
 * You have n problems. You have estimated the difficulty of the i-th one as integer ci.
 * Now you want to prepare a problemset for a contest, using some of the problems you've made.
 *
 * A problemset for the contest must consist of at least two problems.
 * You think that the total difficulty of the problems of the contest must be
 * at least l and at most r.
 * Also, you think that the difference between difficulties of the easiest and the hardest
 * of the chosen problems must be at least x.
 *
 * Find the number of ways to choose a problemset for the contest.
 *
 * Input
 * The first line contains four integers n, l, r, x (1 ≤ n ≤ 15, 1 ≤ l ≤ r ≤ 109, 1 ≤ x ≤ 106)
 * — the number of problems you have, the minimum and maximum value of total difficulty
 * of the problemset and the minimum difference in difficulty between the hardest problem
 * in the pack and the easiest one, respectively.
 *
 * The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 106)
 * — the difficulty of each problem.
 *
 * Output
 * Print the number of ways to choose a suitable problemset for the contest.
 *
 * Input:
 * 4 40 50 10
 * 10 20 30 25
*/

$problems = trim(fgets(STDIN));
$difficulties = trim(fgets(STDIN));

$problemsArray = explode(' ', $problems);
$difficultiesArray = explode(' ', $difficulties);

// Number of problems
$n = $problemsArray[0];
// Min sum
$l = $problemsArray[1];
// Max sum
$r = $problemsArray[2];
// Difference between min and max
$x = $problemsArray[3];

$count = 0;

if ($n == 0)
{
    echo 0;
    exit;
}
else
{
    $subArrays = subArrays($difficultiesArray);

    foreach ($subArrays as $key => $value)
    {
        if (!empty($value))
        {
            $sum = array_sum($value);
            $max = max($value);
            $min = min($value);

            if ($sum <= $r && $sum >= $l && $x <= ($max - $min))
            {
                $count++;
            }
        }
    }
}

echo $count;

/**
 * Get all the sub arrays of a given array
 *
 * @param array $difficulties The given array
 *
 * @return array All the sub arrays
 */
function subArrays($difficulties)
{
    $len = count($difficulties);
    $list = array();

    for ($i = 1; $i < (1 << $len); $i++)
    {
        $subArray = array();

        for ($j = 0; $j < $len; $j++)
        {
            if ($i & (1 << $j))
            {
                $subArray[] = (int)$difficulties[$j];
            }
        }

        $list[] = $subArray;
    }

    return $list;
}


<?php

function readArrayInt($std)
{
    $str = fgets($std);
    $str = explode(' ', $str);
    $a = [];
    $n = count($str);
    for ($i = 0; $i < $n; ++$i)
    {
        $a[] = $str[$i] + 0;
    }
    return $a;
}

function isDelimiter($ch)
{

    if ($ch == '(' || $ch == ')' || $ch == '_')
    {
        return true;
    }
    return false;
}

$stdin = fopen("php://stdin", 'r');
fscanf($stdin, "%d\n", $n);
$str = trim(fgets($stdin));
$res1 = 0;
$res2 = 0;
$inB = false;
for ($i = 0; $i < strlen($str); ++$i)
{
    if (isDelimiter($str[$i]))
    {
        if ($str[$i] != '_')
        {
            $inB = ($str[$i] == '(');
        }
        continue;
    }
    $word = '';
    while ($i < strlen($str) && !isDelimiter($str[$i]))
    {
        $word .= $str[$i];
        $i++;
    }
    if ($inB == true)
    {
        $res2++;
    }
    else
    {
        $res1 = max($res1, strlen($word));
    }
    $i--;
}
echo $res1 . " " . $res2;

fclose($stdin);
?>


<?php

$str = fgets(STDIN, 1000);
$len = strlen($str);
if($len>=1 && $len<=1000){
	$vowels = "AOYEUIaoyeui";
	if(preg_match('/[a-zA-Z]+/', $str)){
		$str = preg_replace('/[^AOYEUIaoyeui\\s]/', '.$0', $str);
		$str = preg_replace('/[AOYEUIaoyeui]/i', '', $str);
		echo strtolower($str);
	}
}
?>


<?php

function read_word() {

    fscanf(STDIN, "%s", $word);
    return $word;
}

function abbreviateWord($word) {

    $vowels = array("a", "o", "y", "e", "u", "i");
    $result = array();

    foreach (str_split($word) as $w) {
        if (!in_array($w, $vowels)) {
            $result[] = $w;
        }
    }

    return "." . implode(".", $result);
}

$word = read_word();
$word = strtolower($word);
$abbr = abbreviateWord($word);
echo $abbr;


<?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';

?>


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


<?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";

?>


<?php
$s = str_split(readline());
$test = ['h', 'e', 'l', 'l', 'o'];
$i= 0;
foreach($s as $letter){
    if($letter == $test[$i]){
        $i++;
        if($i == 5){
            break;
        }
    }
}

if($i == 5){
    echo "YES";
}else{
    echo "NO";
}


<?php
$s = trim(fgets(STDIN));
echo (preg_match("/h.*e.*l.*l.*o/", $s) ? "YES" : "NO");
?>


<?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;


<?php
fscanf(STDIN, "%s", $arr);
$c = strtoupper($arr);
$c[0] = strtolower($arr[0]);
$x = strtolower($arr);
$x[0] = strtoupper($arr[0]);
   if ($arr == strtoupper($arr) ){
      for ($i = 0; $i < strlen ($arr); $i++)
      echo strtolower($arr[$i]);
   }
   else if ($arr == $c){
       for ($i=0; $i < strlen($arr); $i++)
       echo $x[$i];
   }
     else{
         for ($i = 0; $i < strlen ($arr); $i++)
      echo $arr[$i];}


<?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";
}


<?php
list($prob, $min)=explode(" ",trim(fgets(STDIN)));

if ($min > 240) {

    echo 0;
}

$turbo=240 - $min;

for ($i=1; $i <= $prob; $i++) {

      $num += $i * 5;

      if ($i == $prob and $num < $turbo) {
          $final = $i;
          break;
      }elseif ($num == $turbo) {
          $final = $i;
          break;
    }elseif ($num > $turbo) {
          $final = $i - 1;
          break;
    }

    }

if (!isset($final)) {
    echo 0;
}else echo $final;

?>


<?php
$keyboard=array();
$keyboard[0]="qwertyuiop";
$keyboard[1]="asdfghjkl;";
$keyboard[2]="zxcvbnm,./";
$d=trim(fgets(STDIN));
$input=trim(fgets(STDIN));
function solve($d,$input){
    global $keyboard;
    $wo = 0;
    $d=="R" ? $wo=-1 : $wo=1;
    for($i=0;$i<strlen($input);$i++) {
    	foreach ($keyboard as $k2 => $v2) {
    		if(strpos($v2, $input[$i])!==false){
    			$input[$i]=$keyboard[$k2][strpos($v2, $input[$i])+$wo];
    		}
    	}
    }
    return $input;
}
echo solve($d,$input);
?>


<?php
fscanf(STDIN, "%s", $sr);
fscanf(STDIN, "%s %s %s %s %s", $sr1, $sr2, $sr3, $sr4, $sr5);

$cards = [$sr1, $sr2, $sr3, $sr4, $sr5];

$own = str_split($sr);
foreach ($cards as $card) {
    $c = str_split($card);
    if (count(array_diff($c, $own)) != count($own)) {
        echo 'YES';
        exit;
    }
}
echo 'NO';

?>


<?php
$table = str_split(trim(fgets(STDIN)));
$hand = explode(' ', trim(fgets(STDIN)));

foreach ($hand as $card) {
    $card = str_split($card);
    if ($card[0] === $table[0] || $card[1] === $table[1]) {
        echo "YES";
        exit();
    }
}
echo 'NO';


<?php

fscanf(STDIN,"%d\n",$n);
$array = trim(fgets(STDIN));

$array = explode(' ', $array);
$array = array_map('intval', $array);

$mapArray = [];
foreach ($array as $index => $arr) {
    $mapArray[$arr] = $index;
}

$result = [];
foreach ($array as $index => $arr) {
    if(isset($mapArray[$arr]) && $mapArray[$arr] != $index) continue;
    $result[] = $arr;
}

echo count($result)."\n";
echo implode(" ", $result);


<?php
/**
 * Created by PhpStorm.
 * User: jianzjzhang
 * Date: 2018/5/13
 * Time: 17:05
 */

function unique($arr)
{
    $map = array();
    $result = array();

    foreach (array_reverse($arr) as $x){
        if(!array_key_exists($x, $map)){
            $map[$x] = true;
            $result[] = $x;
        }
    }

    return array_reverse($result);
}

function main()
{
    $n = intval(fgets(STDIN));
    $arr = array();

    for($i=0; $i<$n-1; $i++){
        $arr[] = intval(stream_get_line(STDIN, 4096, " "));
    }
    $arr[] = intval(stream_get_line(STDIN, 4096, "\n"));

    $unique_arr = unique($arr);

    echo count($unique_arr)."\n";
    foreach ($unique_arr as $x){
        echo $x.' ';
    }
}

main();


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
$d = trim(fgets(STDIN));
sort($c);
$e = 0;
for($x = 0; $x < $d; $x++)
{
    $e += $c[$x];
}
$f = $d - $a;
if($f > 0)
{
    print $e - ($f * $b);
}
else
{
    print $e;
}
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = "1";
for($x = 1; $x <= $b; $x++)
{
     $c .= "0";
}
$d = 0;
$e = str_split($a);
while(TRUE)
{
     $f = implode($e);
     $g = $f % $c;
     if(strlen($f) <= strlen($c))
     {
          if($g == 0)
          {
               break;
          }
          else
          {
               $h = 1;
               break;
          }
     }
     else
     {
          if($g == 0)
          {
               break;
          }
          else
          {
               $d++;
               $e = str_split($f);
               for($x = count($e) - 1; $x >= 0; $x--)
               {
                    if($e[$x] != 0)
                    {
                         array_splice($e, $x, 1);
                         break;
                    }
               }
          }
     }
}
if($h == 1)
{
     print strlen($a) - 1;
}
else
{
     print $d;
}
?>


<?php
    $n = explode(" ", trim(fgets(STDIN)));
    $arr = array('m' => 0, 'p' => 0, 's' => 0);
    foreach($n as $k => $v){
        $arr[$v[1]] += 1;
    }
    arsort($arr);
  if(reset($arr) == 1){
      echo 2;
  } else if (reset($arr) == 2) {
      foreach($n as $sk => $sv){
          if($sv[1] == array_keys($arr)[0]) {
              $a[] = $sv[0];
          }
      }
      if(abs($a[0] - $a[1]) <= 2) {
          echo 1;
      } else {
          echo 2;
      }
  } else if(reset($arr) == 3) {
      foreach($n as $sk => $sv){
          if($sv[1] == array_keys($arr)[0]) {
              $a[] = $sv[0];
          }
      }
      $b = array_count_values($a);
      arsort($b);
      if(max($a) - min($a) == 0) {
          echo 0;
      } else if (max($a) - min($a) == 2) {
          if(reset($b) < 2) {
              echo 0;
          }else{
              echo 1;
          }
      } else if (max($a) - min($a) > 2){
          $b = array_count_values($a);
          arsort($b);
          $d = array_keys($b);
          sort($d);
          $m1 = $d[0]+1;
          $m2 = $d[2]-1;
          $m3 = $d[1]+1;
          $m4 = $d[1]-1;
          if(reset($b) < 2) {
                if(in_array($m1, $d) || in_array($m2, $d) || in_array($m3, $d) || in_array($m4, $d) || ($m1 == $m4) || ($m3 == $m2)){
                    echo 1;
                } else {
                    echo 2;
                }
          } else {
              echo 1;
          }
      } else {
          echo 1;
      }
  }

 ?>


<?php

$input = readline();
$input = explode(' ', $input);
$price_banan = $input[0];
$have_many = $input[1];
$max_banan = $input[2];
$potracheno=0;

for ($i=0; $i<$max_banan; $i++) {
       $potracheno = $potracheno + $price_banan * ($i+1);
}      $need_many = $potracheno - $have_many;
     if ($need_many <=0) {
         echo '0';
     }
     else {
         echo $need_many;
     }


<?php

$input = rtrim(fgets(STDIN));
$raw   = explode(' ', $input);

$k = (int)$raw[0];
$n = (int)$raw[1];
$w = (int)$raw[2];

$priceFirst = $k;
$priceLast  = $k + $k * ($w - 1);
$sum        = ($priceFirst + $priceLast) * $w / 2;

echo max(0, $sum - $n) . PHP_EOL;


<?php
$n = trim(fgets(STDIN));
$a = trim(fgets(STDIN));
$a = explode( ' ' , $a);
sort($a);
echo join(' ', $a);


<?php
$n = trim(fgets(STDIN));
$cube = explode(" ", trim(fgets(STDIN)));
for($i=$n-1;$i>=0;$i--){
    for($j=$n-1;$j>=0;$j--){
		if ($cube[$i] > $cube[$j]){
			$sisa = $cube[$i] - $cube[$j];
			$cube[$j] += $sisa;
			$cube[$i] -= $sisa;
		}
	}
}
foreach($cube as $value){
	echo $value . " ";
}
?>


<?php

$str = trim(fgets(STDIN));
$count = 0;
$targets = '13579aiueo';
for ($i = 0; $i < strlen($str); $i++)
{
	if (strpos($targets, $str[$i]) !== false)
	{
		$count++;
	}
}

echo $count;


<?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;
}


<?php

fscanf(STDIN,"%d\n",$n);
$string = trim(fgets(STDIN));

$inputN = $n;

while(true) {
    $string = str_replace('xxx', 'xx', $string);
    $len = strlen($string);
    if($len == $n) break;
    $n = $len;
}

if($len == $inputN) {
    echo "0";
} else {
    echo $inputN - $len;
}


<?php
/**
 * Created by PhpStorm.
 * User: jianzjzhang
 * Date: 2018/5/13
 * Time: 17:25
 */

function removeCount($str)
{
    $char_arr = str_split($str, 1);

    $counter = 0;

    $need_remove = 0;
    foreach ($char_arr as $ch){
        if($ch === 'x'){
            $counter++;
        }
        else{
            $counter = 0;
        }

        if($counter === 3){
            $need_remove++;
            $counter--;
        }
    }

    return $need_remove;
}

function main()
{
    $n = intval(fgets(STDIN));
    $str = fgets(STDIN);

    echo removeCount($str)."\n";
}

main();


<?php
$ns = explode(" ", fgets(STDIN));
$s2arr = explode(" ", fgets(STDIN));

$n = $ns[0];
$s = $ns[1];
sort($s2arr);
$s2 = array_sum($s2arr) - $s2arr[($n-1)];
if ($s2 > $s)
    print "NO";
else
    print "YES";


<?php
$input=str_split(trim(fgets(STDIN)));
$input2=str_split(trim(fgets(STDIN)));
$a=null;
for ($i=0;$i<count($input);$i++) {
      if($input[$i] == $input2[$i]){
        $a.='0';
      }else{
            $a.='1';
      }
}
echo $a;


<?php
$line1 = trim(fgets(STDIN));
$line2 = trim(fgets(STDIN));
$length = strlen($line1);
for ($i=0;$i<$length;$i++)
{
    if ($line1[$i]==$line2[$i])echo 0;
    else echo 1;
}


<?php
	$length = trim(fgets(STDIN));
	$string = (string) trim(fgets(STDIN));
	$array = array();

	for ($i=0; $i < $length; $i++) {
		   if($string[$i] == '1')
		   		 continue;
		   if($string[$i] == '2')
		   		array_push($array, 2);
		   if($string[$i] == '3')
		   		array_push($array, 3);
		   if($string[$i] == '4')
		   		array_push($array, 2, 2, 3);
		   if($string[$i] == '5')
		   		array_push($array, 5);
		   if($string[$i] == '6')
		   		array_push($array, 5, 3);
		   if($string[$i] == '7')
		   		array_push($array, 7);
		   if($string[$i] == '8')
		   		array_push($array, 2, 2, 2, 7);
		   if($string[$i] == '9')
		   		array_push($array, 7, 2, 3, 3);
	}

	sort($array);
	for ($i=count($array) - 1; $i >= 0; $i--) {
			   echo $array[$i];
	}
?>


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


<?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();
	}


<?php
	$flag = false;
	$lucky = array(4,7,44,47,74,77,444,447,474,477,744,747,774,777);
	$var = trim(fgets(STDIN));
	if ((strlen($var) - substr_count($var, '4') - substr_count($var, '7')) > 0) {
		foreach ($lucky as $l) {
			if ((int)$var % $l == 0) {
				echo 'YES';
				$flag = true;
				break;
			}
		}
		if ($flag == false) echo 'NO';
	}
	else echo 'YES';


<?php

list($n, $m) = explode(' ', fgets(STDIN));

$n = (int)$n;
$m = (int)$m;

$output = $n;

$t = $m;

while ($t <= $output) {
	$output ++;
	$t += $m;
}

print $output;


<?php

function Finddays($nm){

    $nm = explode(" ", $nm);
    $n  = $nm[0];
    $m  = $nm[1];

    $count = 0;

    $d = (int)($n/$m);
    $mod = $n%$m;
    $s = $d+$n;
    $dc = $d +$mod;
    $mod=0;
    while($dc>=$m){
        $d = (int)($dc/$m);
        $s += $d;
        $mod = $dc%$m;

        $dc =$d+$mod;

    }

    echo $s;
}

$nm = trim(fgets(STDIN));

Finddays($nm);


<?php
$n=fgets(STDIN);
$input=str_split(fgets(STDIN));
$grop=[];
$b=0;
for ($i=0; $i <count($input);$i++) {
      if ($input[$i] == 'B' and $input[$i+1] == 'B') {
            @$grop[$b]+=1;
      }else if($input[$i] == 'B' and $input[$i+1] != 'B'){
            @$grop[$b]+=1;
            $b++;
      }
}
echo count($grop);
if(count($grop) == 0){
   return 0;
}
echo "\n";
foreach ($grop as $value) {
      echo $value.' ';
}


<?php
    $n = fgets(STDIN);
    $a = explode(" ", fgets(STDIN));

    foreach ($a AS $k => $v) {
        if ($v == 0) {
            unset($a[$k]);
        }
    }
    funcMax($a, max($a), array());
    function funcMax($a, $max, $count) {
        $count[] = $max;
        foreach ($a AS $key => $val) {
            if ((int)$val == (int)$max) {
                unset($a[$key]);
            }
        }
        if ($a) {
            funcMax($a, max($a), $count);
        } else {
            echo count($count);
        }
    }

?>


<?php
$n = intval(fgets(STDIN, 255));
$classA = explode(' ', fgets(STDIN, 255));
$classB = explode(' ', fgets(STDIN, 255));

for ($i = 0; $i < $n; ++$i)
    $classA[$i] = intval($classA[$i]);
for ($i = 0; $i < $n; ++$i)
    $classB[$i] = intval($classB[$i]);

$arrayCount = [
    'ALL' => [
        1 => 0,
        2 => 0,
        3 => 0,
        4 => 0,
        5 => 0,
    ],
    'A' => [
        1 => 0,
        2 => 0,
        3 => 0,
        4 => 0,
        5 => 0,
    ],
    'B' => [
        1 => 0,
        2 => 0,
        3 => 0,
        4 => 0,
        5 => 0,
    ]
];

foreach ($classA as $value) {
    ++$arrayCount['A'][$value];
    ++$arrayCount['ALL'][$value];
}
foreach ($classB as $value) {
    ++$arrayCount['B'][$value];
    ++$arrayCount['ALL'][$value];
}

foreach ($arrayCount['ALL'] as $value) {
    if ($value % 2 != 0)
        exit('-1');
}

$result = 0;
$ok = 0;
$swap = 0;
while ($ok != 5) {
    $ok = 0;
    for ($i = 1; $i <= 5; ++$i) {
        if ($arrayCount['A'][$i] != $arrayCount['B'][$i]) {
            if ($arrayCount['A'][$i] > $arrayCount['B'][$i]) {
                --$arrayCount['A'][$i];
                ++$arrayCount['B'][$i];
            } else {
                ++$arrayCount['A'][$i];
                --$arrayCount['B'][$i];
            }
            $swap++;
            if ($swap % 2 == 0)
                $result++;
        }

        if ($arrayCount['A'][$i] == $arrayCount['B'][$i])
            $ok++;
    }
}

echo $result;


<?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";


<?php
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%s", $s);
echo (substr_count($s, "SF") > substr_count($s, "FS") ? "YES" : "NO");
?>


<?php

error_reporting(0);
ob_end_clean();

solve();

function solve(){
	$Scanner = new Scanner("php://stdin");
	//$Scanner = new Scanner("input.txt");

	$N = (int)$Scanner->Scan();
	$X = (int)$Scanner->Scan();
	$Y = (int)$Scanner->Scan();

	$temp = (string)(($N * ($Y / 100)));
	$temp = ceil($temp);
	$need = max($temp - $X, 0);

	print($need);

	$Scanner->Close();
}

class Scanner{
	private $Stream;
	private $Scanners = array();
	private $Id = 0;

	public function __construct($opend){
		$this->Stream = fopen($opend, 'r');
		$contents = stream_get_contents($this->Stream);
		$contents = str_replace(array("\r\n", "\r", "\n"), " ", $contents);
		$this->Scanners = explode(" ", $contents);
	}

	public function Scan(){
		return $this->Scanners[$this->Id++];
	}

	public function Close(){
		fclose($this->Stream);
	}
}

?>


<?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);
?>


<?php
//$file = fopen('input.in', 'r');
$file = STDIN;
list($a, $b) = explode(" ", trim(fgets($file)));
if ($a > $b) {
    $c = $a;
    $a = $b;
    $b = $c;
}
echo $a . " " . floor(($b - $a)/2);


#!/usr/bin/env php
<?php

if (PHP_OS == 'WINNT') {
    $line = stream_get_line(STDIN, 1024, PHP_EOL);
} else {
    $line = readline();
}

$n = explode(' ', $line)[0];
$k = explode(' ', $line)[1];

$count = ceil(2*$n/$k) + ceil(5*$n/$k) + ceil(8*$n/$k);

echo $count;


<?php

	$input = trim(fgets(STDIN));
	$input_split=explode(" ",$input);
	$friend=$input_split[0];
	$paper=$input_split[1];
	$red_paper_needed=2*$friend;
	$green_paper_needed=5*$friend;
	$blue_paper_needed=8*$friend;
	$book_with_red_paper_needed=$red_paper_needed/$paper;
	$book_with_green_paper_needed=$green_paper_needed/$paper;
	$book_with_blue_paper_needed=$blue_paper_needed/$paper;
	if(is_float($book_with_red_paper_needed)){
		$book_with_red_paper_needed=intval($book_with_red_paper_needed)+1;
	}
	if(is_float($book_with_green_paper_needed)){
		$book_with_green_paper_needed=intval($book_with_green_paper_needed)+1;
	}
	if(is_float($book_with_blue_paper_needed)){
		$book_with_blue_paper_needed=intval($book_with_blue_paper_needed)+1;
	}
	echo $book_with_red_paper_needed+$book_with_green_paper_needed+$book_with_blue_paper_needed;

?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$e = array();
$f = array();
$i = array();
for($x = 1; $x <= $b; $x++)
{
    list($c, $d) = explode(" ", trim(fgets(STDIN)));
    array_push($e, $c);
    array_push($f, $d);
}
arsort($f);
$h = array_keys($f);
for($x = 0; $x < $b; $x++)
{
    if($a > $e[$h[$x]])
    {
        $g = $e[$h[$x]] * $f[$h[$x]];
        array_push($i, $g);
    }
    else
    {
        $g = $a * $f[$h[$x]];
        array_push($i, $g);
        break;
    }
    $a -= $e[$h[$x]];
}
print array_sum($i);
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
list($c, $d) = explode(" ", trim(fgets(STDIN)));
$e = $c - 2;
$f = array();
$g = $a;
for($x = 1; $x <= $e; $x++)
{
    $g += $d;
    array_push($f, $g);
}
array_unshift($f, $a);
array_push($f, $b);
if($f[count($f) - 1] >= $f[count($f) - 2])
{
    print array_sum($f);
}
else
{
    $f = array_reverse($f);
    for($x = 1; $x < count($f); $x++)
    {
        $h = $f[$x] - $f[$x - 1];
        if($h > $d)
        {
            $f[$x] = $f[$x - 1] + $d;
        }
        else
        {
            break;
        }
    }
    print array_sum($f);
}
?>


<?php

$line = trim(fgets(STDIN));

for ($i = 0; $i <= 20; $i++) {
    $line = str_replace('///', '/', $line);
    $line = str_replace('//', '/', $line);
}

if ((substr($line, -1, 1) == '/') && ($line != '/')) $line = substr($line, 0, strlen($line) - 1);

echo $line;

?>


<?php

$stdin = fopen('php://stdin', 'r');
$str = trim(fgets($stdin));
$stri = strrev($str);
$len = strlen($str) % 2 == 0 ? intval(strlen($str) / 2) : intval(strlen($str) / 2) + 1;
$counter = 0;
for ($i = 0; $i < $len; $i++) {
    if ($str[$i] != $stri[$i]) {
        $counter++;
    }
    if ($counter > 1) {
        break;
    }
}
if ($counter == 0) {
    if (strlen($str) % 2 == 1) {
        echo "YES";
    } else {

        echo "NO";
    }
} else if ($counter == 1) {
    echo "YES";
} else {
    echo "NO";
}


<?php

###### IO ######
error_reporting(E_ALL);
#error_reporting(0);

function readString($f) {
	$r = array(
		"\r" => '',
		"\n" => '',
	);
	return strtr(fgets($f), $r);
}

function readNumString($f) {
	return trim(fgets($f));
}

function stringToArray($str) {
	return str_split($str);
}

function readNum($f, $is_int = false) {
	$v = readNumString($f);
	return $is_int ? intval($v) : floatval($v);
}

function readStringExplode($f, $delimiter = ' ') {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = 'trim';
	return array_map($callf, $return);
}

function readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = $is_int ? 'intval' : 'floatval';
	return array_map($callf, $return);
}

function readNumArray($f) {
	return readStringExplodeNum($f, ' ', true);
}

function readArray($f) {
	return readStringExplodeNum($f, ' ');
}

function readTrimString($f) {
	return trim(readString($f));
}

###### /IO ######
# for($i=0;$i<$n;$i++)

function getAnswer($is_test = false, $f = false) {
	if ($is_test === false) {
		$f = STDIN;
	}
	/* begin body */
	list($first, $last) = array_map('trim', readStringExplode($f, ' '));
	$sec = readNum($f);
	$sec %= 4;

	$path = '^>v<';
	$cwPath = $path . $path . $path . $path;
	$cwwPath = strrev($path) . strrev($path) . strrev($path) . strrev($path);
	$firstPos = strpos($cwPath, $first);
	$endCwChar = $cwPath[$firstPos + $sec];

	$firstPos = strpos($cwwPath, $first);
	$endCcwChar = $cwwPath[$firstPos + $sec];
	if ($endCwChar == $endCcwChar) {
		echo 'undefined';
	} elseif ($endCwChar == $last) {
		echo 'cw';
	} elseif ($endCcwChar == $last) {
		echo 'ccw';
	} else {
		echo 'undefined';
	}

	/* / end body */
}

if (!isset($is_test)) {
	$is_test = false;
}
if (empty($is_test)) {
	getAnswer();
}


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
if($b == 0)
{
     print "No";
}
elseif($b == 1)
{
     if($a == 0)
     {
          print "Yes";
     }
     else
     {
          print "No";
     }
}
elseif($b > 1)
{
     if($a < $b)
     {
          $c = $b - $a;
          if($c == 1)
          {
               print "Yes";
          }
          else
          {
               print "No";
          }
     }
     elseif($a == $b)
     {
          print "No";
     }
     elseif($a > $b)
     {
          $a -= ($b - 1);
          $c = $a % 2;
          if($c == 0)
          {
               print "Yes";
          }
          else
          {
               print "No";
          }
     }
}
?>


<?php

fscanf(STDIN, "%d %d\n", $copy, $original);
if ($original === 1 && $copy === 0) {
    echo 'Yes';
    exit;
}

if (
    (($original - 1) < 1) ||
    (1 === ($copy - $original + 1) % 2) ||
    (($copy - $original + 1) < 0)
) {
    echo 'No';
} else {
    echo 'Yes';
}


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


<?php
$a = trim(fgets(STDIN));
$b = floor($a / 2);
$c = $a - $b;
$d = $a - $b;
print $b + $c + $d;
?>


<?php

###### IO ######
error_reporting(E_ALL);
#error_reporting(0);

function readString($f) {
	$r = array(
		"\r" => '',
		"\n" => '',
	);
	return strtr(fgets($f), $r);
}

function readNumString($f) {
	return trim(fgets($f));
}

function stringToArray($str) {
	return str_split($str);
}

function readNum($f, $is_int = false) {
	$v = readNumString($f);
	return $is_int ? intval($v) : floatval($v);
}

function readStringExplode($f, $delimiter = ' ') {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = 'trim';
	return array_map($callf, $return);
}

function readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {
	$v = readNumString($f);
	if ($delimiter == '') {
		$return = stringToArray($v);
	} else {
		$return = explode($delimiter, $v);
	}
	$callf = $is_int ? 'intval' : 'floatval';
	return array_map($callf, $return);
}

###### /IO ######

function getAnswer($is_test = false, $f = false) {
	if ($is_test === false) {
		$f = STDIN;
	}
	/* begin body */
	$chars = array('A' => true, 'E' => true, 'I' => true, 'O' => true, 'U' => true, 'Y' => true);

	$str = strtoupper(readString($f));
	$len = strlen($str);
	$max = 1;
	$current = 1;
	for ($i = 0; $i < $len; $i++) {
		if (!empty($chars[$str[$i]])) {
			$current = 1;
			continue;
		}
		$current++;
		$max = max($max, $current);
	}
	echo $max;
	/* / end body */
}

if (empty($is_test))
	getAnswer();


<?php
list($a,$b,$c) = explode(' ',trim(fgets(STDIN)));

print $b*$c+($a-1)*($b+$c-1);
?>


<?php
  list( $grownups, $childs ) = explode( ' ', file_get_contents( "php://stdin" ) );

  if( $grownups == 0 && $childs != 0 )
      die( "Impossible" );

  $grownups = (int)$grownups;
  $childs   = (int)$childs;

  $min = 0;
  $max = 0;

  if( $grownups > $childs )
      $min = $grownups;
  else
      $min = $grownups + abs( $grownups - $childs );

  $max = $grownups + ( $childs > 0 ? $childs - 1 : 0 );

  echo $min, ' ', $max;


<?php

list($Parent, $Childs) = explode(' ', trim(fgets(STDIN)));

if ($Childs == 0)
    $max = $Parent;
else
    $max = $Parent + $Childs - 1;
if ($Childs >= $Parent)
    $min = $Parent + ($Childs - $Parent);
else
    $min = $Parent;

if (($Parent == 0) && ($Childs != 0))
    echo "Impossible";
else
    print $min . ' ' . $max;

?>


<?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;


<?php
$count = (int) trim(fgets(STDIN));
$array = explode(' ', trim(fgets(STDIN)));

$iMax = 0;
$countMax = 0;
$resultArray = [];
for ($i = 0; $i < $count; $i++) {
    if (!isset($resultArray[$array[$i]])) {
        $resultArray[$array[$i]] = 1;
    } else {
        $resultArray[$array[$i]]++;
    }
    if ($resultArray[$array[$i]] > $countMax) {
        $countMax = $resultArray[$array[$i]];
    }

}
echo $countMax;


<?php
while ($s = fgets(STDIN))
{
    $kto[] = trim($s);
}

$kol_vo = $kto[count($kto) - 1];
array_pop($kto);

for ($i = 0; $i < $kol_vo; $i++)
{
    $mas[$i] = $i + 1;
}
for ($i = 0; $i < count($kto); $i++)
{
    for ($j = 0; $j < $kol_vo; $j++)
    {
        if ($mas[$j] % $kto[$i] == 0)
            unset($mas[$j]);
    }
}
$vsego = $kol_vo - count($mas);
echo $vsego;

?>


<?php

$d1 = readline();
$d2 = readline();
$d3 = readline();
$d4 = readline();
$vsego = readline();
$killed = 0;

for ($drag = 1; $drag < $vsego+1 ; $drag++) {

    if ($drag % $d1 == 0 || $drag % $d2 == 0 || $drag % $d3 == 0 || $drag % $d4 == 0) {
        $killed += 1;
    }
}
echo $killed;


<?php

list($n,$m)=fscanf(STDIN,"%d %d");
$stps=0;
while($n<$m)    {
	if($m%2)    $m++;
	else    $m/=2;
	$stps++;
}

echo $stps+$n-$m."\n";

?>


<?php

$limit = trim(fgets(STDIN));

$n = 1;
$sum = 1;

while (true) {
    $level = (($n + 2) * ($n + 1)) / 2;
    if ($sum + $level <= $limit) {
        $sum += $level;
        $n++;
    } else {
        break;
    }
}

echo $n;


<?php
$n = (int)fgets(STDIN);

$cubes = 1;
$plus = 2;

for ($i = 0; ; $i++) {
  if ($n < $cubes) {
    break;
  }
  $n -= $cubes;
  $cubes += $plus++;
}

echo $i;


<?php
list($n) = explode(" ", trim(fgets(STDIN)));

$std = explode(" ", trim(fgets(STDIN)));
sort($std);

$t = 0;

for ($i=0; $i < $n/2; $i++) {
	$t += abs($std[2 * $i] - $std[2 * $i + 1]);
}

echo $t ,"\n";


<?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;
}
?>


<?php
//$file = fopen('input.in', 'r');
$file = STDIN;
list($n, $m) = explode(" ", trim(fgets($file)));
$result = 0;
if ($n % 2 === 0) {
    $middle = $n / 2;
    if ($m <= $middle) {
        $result = $m + 1;
    } else {
        $result = $m - 1;
    }
} else {
    $middle = ($n + 1) / 2;
    if ($m >= $middle) {
        $result = $m - 1;
    } else {
        $result = $m + 1;
    }
}
if ($result == 0) {
    $result = 1;
}
echo $result;


<?php
$stdin = fopen("php://stdin", "r");
$stdout = fopen("php://stdout", "w");
$t = fgets($stdin);
$l = strlen($t);
$mx = 0;
$cnt = 0;
for($i = 0; $i < $l; ++$i){
    if(ord($t[$i]) > $mx){
        $cnt = 1;
        $mx = ord($t[$i]);
        continue;
    }
    if(ord($t[$i]) == $mx){
        $cnt ++;
        continue;
    }
}
for($i = 0; $i < $cnt; ++$i){
    fwrite($stdout,chr($mx));
}
fclose($stdin);
fclose($stdout);
?>


<?php
    $stdin = fopen('php://stdin', 'r');
    $stdout = fopen('php://stdout', 'w');
    $string = fgets($stdin);

    for($i=1;$i<strlen($string);++$i){
        for($j=0;$j<$i;++$j){
            $tmp[]=substr($string, $j, $i-$j);
        }
    }

    $curMaxLen=0;
    $count = array_count_values($tmp);
    foreach($tmp as $elem){
        if(($count[$elem]>=2)&&($curMaxLen<strlen($elem))) $curMaxLen=strlen($elem);
    }

    fputs($stdout, $curMaxLen);

?>


<?php
$a = trim(fgets(STDIN));
$b = trim(fgets(STDIN));
$d = 0;
for($x = 1; $x <= 1000; $x++)
{
    $c = pow($a, $x);
    if($b == $c)
    {
        $d = 1;
        break;
    }
    elseif($b < $c)
    {
        break;
    }
}
if($d == 1)
{
    print "YES" . "\n";
    print $x - 1;
}
else
{
    print "NO";
}
?>


<?php

$flag = 1; //must be not zero for STDIN

$in = 'php://stdin';
if (!$flag)
{
    $in = "input.txt";
}
$fd = fopen($in, "r");
fscanf($fd, "%d\n", $k);
fscanf($fd, "%d\n", $l);
fclose($fd);

$r = (log($l, $k));
$s = strstr ( $r, '.' );
if (!$s)
{
    print "YES\n";
    $r--;
    print "$r\n";
} else
{
    print "NO\n";
}
?>


<?php
    $fp = fopen('php://stdin', 'r');
    echo 4 - count(array_unique(explode(' ', rtrim(fgets($fp)))));
?>


<?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);
?>


<?php
fscanf(STDIN,"%d %d",$len,$k);
fscanf(STDIN,"%s",$str);
$obstract=array();
for ($i=0; $i <$len ; $i++)
{
	if($str[$i]=='T')
		$target=$i+1;
	 if($str[$i]=='G')
	 	$start=$i+1;

}
if($start>$target)
 {
	$tmp=$start;
	$start=$target;
	$target=$tmp;
}

     // $obstract=0;

	   for ($i=$start-1;; $i+=$k)
	    {
	    	   //echo "i=$i target=$target\n";
		       if($i>$target-1)
		       {
		       	  echo "NO\n";
		       	  break;
		       }
		   	   if($i==$target-1)
		   	   {
		   	   	   echo "YES\n";
		   	   	   break;
		   	   }

		   	   if($str[$i]=='#')
		   	   {
		   	   	  echo "NO\n";
		   	   	  break;
		   	   }

	    }

/*
if($flag==1)
	echo "YES\n";
else
	echo "NO\n";
*/


<?php
list($len, $jump)=explode(" ", trim(fgets(STDIN)));
$str=str_split(trim(fgets(STDIN)));
$u=$jump;

foreach ($str as $key => $value) {
    if ($value == "G") {
     $g=$key;
    }
    if ($value == "T") {

      $tg=$key;
    }

}

while (TRUE) {
$t= $g + $jump;
$t1=$g - $jump;

if ($tg < $g) {
if ($str[$t1] == "#") {

    echo "NO";
    break;
}elseif ($str[$t1] == "T") {

    echo "YES";
    break;
}else $jump = $u + $jump;
}
if ($tg > $g) {
if ($str[$t] == "#") {

    echo "NO";
    break;
}elseif ($str[$t] == "T") {

    echo "YES";
    break;
}else $jump = $u + $jump;

 }

  if ($jump > $len){

     echo "NO";
     break;

}

}

?>


<?php

list($n, $c) = explode(' ', get_line());

$n = (int)$n;
$c = (int)$c;

$x = explode(' ', get_line());
$n = min($n, count($x));

for ($i = 0; $i < $n; $i ++) {
  $x[$i] = (int)$x[$i];
}

$answer = 0;

for ($i = 0; $i+1 < $n; $i ++) {
  if ($x[$i] - $c > $x[$i+1]) {
    $answer = max($answer, $x[$i] - $c - $x[$i+1]);
  }
}

print $answer;

function get_line() {
  return trim(fgets(STDIN));
}


#!/usr/bin/php -c -q
<?php
class Token {
	private $token;
	private $tok;

	public function __construct($str_line, $tok) {
		$this->tok = $tok;
		$this->token = strtok($str_line, $this->tok);
	}

/*  //unuseful firstversion
	public function nextToken() {

		if (Token::$first === true) {
 			if ($this->$firstToken !== false) {
				Token::$first = false;
				//self::$first = false;
				return $this->$firstToken;
			} else {
				return -1;
		} else {
			$nextToken = strtok(" ");
			if ($nextToken !== false) {
				return $nextToken;
			} else {
				return -1;
			}
		}
	}
*/
	public function nextToken() {
		$thisToken = $this->token;
		//$this->token = strtok(" ");
		$this->token = strtok($this->tok);
		return $thisToken;
	}

	public function nextFloat() {
		return (float)$this->nextToken();
	}
}

/*
function getLines($str_lines) {
	while (true) {

		$str_line = rtrim(fgets(STDIN, 10), "\n");

		//null�����strlen($num) < 1�H
    	if (!ctype_digit($str_line) || strlen($str_line) < 1) {
        	break;
    	}

		$str_lines[] = $str_line;
	}
	return $str_lines;
}
function putLinesIn(&$str_lines) {
	while (true) {

		$str_line = rtrim(fgets(STDIN, 10), "\n");

		//null�����strlen($num) < 1�H
    	if (!ctype_digit($str_line) || strlen($str_line) < 1) {
        	break;
    	}

		$str_lines[] = $str_line;
	}
}
function getStringArray($str_line, $str_arr) {
	$firstToken = strtok($str, " ");
	if ($firstToken === false) return -1;
	else $fl_arr[] = $firstToken;

	$nextToken = strtok($str);
	while ($nextToken !== false) {
		$fl_arr[] = $nextToken;
		$nextToken = strtok($str);
	}
	return $str_arr;
}
*/

/*string �� array
//���K�\�����K�v  preg_split
//���K�\�����s�v  explode(), str_split()(more speedy but more simple)

//1.example of explode()  (best)
function putStringsIn($str_line) {
	if ($str_line === null) $str_arr = null;
	elseif (strpos($str_line, " ") === false) $str_arr = $str_line;
	else $str_arr = explode(" ", $str_line);

	return $str_arr;
}

//2.example getting of arr from str, and using strtok  (unuseful)
function putStringsIn($str_line) {
	$str_arr = array();

	$firstToken = strtok($str_line, " ");
	if ($firstToken !== false) {
		$str_arr[] = $firstToken;
		$nextToken = strtok($str_line);
		while ($nextToken !== false) {
			$str_arr[] = $nextToken;
			$nextToken = strtok($str_line);
		}
	}
}

//3.example getting of float arr from str, and using strtok  (unuseful)
function getFloatArray($str_line, $fl_arr) {
	$firstToken = (float)strtok($str_line, " ");
	if ($firstToken === false) return -1;
	else $fl_arr[] = $firstToken;

	$nextToken = (float)strtok($str_line);
	while ($nextToken !== false) {
		$fl_arr[] = $nextToken;
		$nextToken = strtok($str_line);
	}
	return $fl_arr;
}

//4.the same way, except using &$fl_arr  (unuseful)
function putFloatsIn($str_line, &$fl_arr) {
	$firstToken = (float)strtok($str_line, " ");
	if ($firstToken === false || count($fl_arr) !== 0) return -1;
	else $fl_arr[] = $firstToken;

	$nextToken = (float)strtok($str_line);
	while ($nextToken !== false) {
		$fl_arr[] = $nextToken;
		$nextToken = strtok($str_line);
	}
}
*/

/*
change of data fomat of arrays

//1.basic code
array_map('strval', $arr), array_map('floatval', $arr)
//2.unuseful firstversion
function nextFloat($str) {
	return (float)$str;
}
*/

/*solve using foreach for reading input
function solve(){

	$str_lines = array();
	putLinesIn($str_lines);
	foreach ($str_lines as $str_line) {
		$str_arr = array();
		putStringsIn($str_line, &$str_arr);
		//$fl_arr = array();
		//foreach ($str_arr as $str) {
			//$fl_arr[] = (float)$str;
		//}
		$fl_arr = array_map('floatval', $arr);

		$vp = $fl_arr[0];
		$vd = $fl_arr[1];
		$t = $fl_arr[2];
		$f = $fl_arr[3];
		$c = $fl_arr[4];

		$ttake = ($vp * $t) / ($vd - $vp);
		$dis = $vp * ($t + $ttake);
		$less = $c - $dis;
		$int_count = 0;
		$EPS = 1e-9;

		while ($less > $EPS) {
			$int_count++;
			$t = $t + 2 * $ttake + $f;
			$ttake = ($vp * $t) / ($vd - $vp);
			$dis = $vp * ($t + $ttake);
			$less = $c - $dis;
		}

		printf(%d,$int_count);
	}
}
*/
//solve using strtok or class Toke for reading input
function solve(){

/* basic coding (this code is not best, because changing token and float is not good)
	$vp = (float)strtok(rtrim(fgets(STDIN, 10), "\n"), " ");
	$vd = (float)strtok(" ");
	$t = (float)strtok(" ");
	$f = (float)strtok(" ");
	$c = (float)strtok(" ");
*/
	//use Token class(advatage of using this class is changing token and float is more easy)
	//$Token = new Token(rtrim(fgets(STDIN, 5), "\n"), " ");
	$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$vp = $Token->nextFloat();
	$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$vd = $Token->nextFloat();
	$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$t = $Token->nextFloat();
	$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$f = $Token->nextFloat();
	$Token = new Token(rtrim(fgets(STDIN), "\n"), " ");
	$c = $Token->nextFloat();

/* another coding if possible
	1.for
	for ($temp = $Token->nextFloat();;$temp = $Token->nextFloat();) {
		if ($temp === false) break;
		$vp = $temp;
		�E
		�E
		�E
	}

	2.while
	$temp = $Token->nextFloat();
	while($temp !== false) {
		$vp = $temp;
		�E
		�E
	}
*/
	$int_count = 0;
	if ($vd <= $vp) {
		printf('%d', $int_count);
		return;
	}

	$ttake = ($vp * $t) / ($vd - $vp);
	$dis = $vp * ($t + $ttake);
	$less = $c - $dis;
	$EPS = 1e-9;
	while ($less > $EPS) {
		$int_count++;
		$t = $t + 2 * $ttake + $f;
		$ttake = ($vp * $t) / ($vd - $vp);
		$dis = $vp * ($t + $ttake);
		$less = $c - $dis;
	}

	//printf(%d, $int_count);
	printf('%d', $int_count);
}

function run(){
	solve();
}

ob_end_clean();
run();
?>


<?php

class Segment {
	public function __construct($a) {
		if ($a[0] < $a[2] || ($a[0] == $a[2] && $a[1] < $a[3]))
			$this->a = $a;
		else
			$this->a = array($a[2], $a[3], $a[0], $a[1]);
	}
	public static function create($a, $b, $c, $d) {
		return new Segment(array($a, $b, $c, $d));
	}
	// public function __is_equal($other) {
	// 	return $this->a == $other->a;
	// }
	public function __toString() {
		return implode(', ', $this->a);
	}
}

$sa = array();
$M = 10**9;
$min_x = $M; $max_x = -$M;
$min_y = $M; $max_y = -$M;
for ($i = 0; $i < 4; $i++) {
	$a = array_map("intval", explode(' ', fgets(STDIN)));
	$min_x = min($min_x, min($a[0], $a[2]));
	$max_x = max($max_x, max($a[0], $a[2]));
	$min_y = min($min_y, min($a[1], $a[3]));
	$max_y = max($max_y, max($a[1], $a[3]));
	$sa[$i] = new Segment($a);
}
$sb = array(
	Segment::create($min_x, $min_y, $max_x, $min_y),
	Segment::create($min_x, $min_y, $min_x, $max_y),
	Segment::create($max_x, $max_y, $max_x, $min_y),
	Segment::create($max_x, $max_y, $min_x, $max_y)
);
// print(implode(' | ', $sa)."\n");
// print(implode(' | ', $sb)."\n");
$equal = (array_merge(array_diff($sa, $sb), array_diff($sb, $sa)) == array());
print($equal && $min_x != $max_x && $min_y != $max_y ? "YES\n" : "NO\n");
?>


<?php
fscanf(STDIN, " %d %d", $n, $c);
$p = array_map(function($x){ return (int)$x; }, explode(" ", fgets(STDIN)));
$t = array_map(function($x){ return (int)$x; }, explode(" ", fgets(STDIN)));
$l = 0;
$r = 0;
$t_l= 0;
$t_r = 0;
for ($i = 0; $i < $n; $i++) {
    $t_l += $t[$i];
    $t_r += $t[$n - 1 - $i];
    $l += max($p[$i] - $c*$t_l, 0);
    $r += max($p[$n - 1 - $i] - $c*$t_r, 0);
}
if ($l > $r)
    echo "Limak";
else if ($l < $r)
    echo "Radewoosh";
else
    echo "Tie";
?>


<?php
$input = file_get_contents('php://stdin');
$output = '';
$tmp = explode(' ', $input);
$x = intval($tmp[0]);
$y = intval($tmp[1]);
$dist = sqrt($x*$x+$y*$y);
if($dist == intval($dist) || $x == 0 || $y == 0){
	file_put_contents('php://stdout', 'black');
	exit;
}
if($x*$y > 0){
	if(floor($dist)%2 == 0){
		$output = 'black';
	}else{
		$output = 'white';
	}
}else{
	if(floor($dist)%2 == 0){
		$output = 'white';
	}else{
		$output = 'black';
	}
}
file_put_contents('php://stdout', $output);
?>


<?php
$f = fopen( 'php://stdin', 'r' );
$a = explode(' ', fgets($f));
// a[0] la so phan trong hop(section)
// a[1] la so hat (nut)
// a[2] la so lan chia (divisor)
// a[3] la so hat trong phan (nut in section)

// tinh so section
$section_necessary = ($a[1] % $a[3] == 0) ? ($a[1] / $a[3]) : (floor($a[1] / $a[3]) + 1);
$so_hop_chia_toi_da = floor($a[2] / ($a[0]-1));
$so_hop_duoc_chia = ceil($a[2] / ($a[0]-1));
$so_phan_duoc_tao_ra = $so_hop_chia_toi_da * $a[0] + $a[2] - $so_hop_chia_toi_da * ($a[0]-1) + 1;
if ($section_necessary <= $so_phan_duoc_tao_ra)
    echo ceil($section_necessary/$a[0]);
else {
    if( $so_hop_duoc_chia == $so_hop_chia_toi_da)
        echo $so_hop_chia_toi_da + ($section_necessary - $so_hop_chia_toi_da * $a[0]);
    else
        echo $so_hop_duoc_chia + $section_necessary - $so_phan_duoc_tao_ra;
}
// echo $section_necessary;


<?php

fscanf(STDIN,"%d%d%d%d",$a,$b,$c,$d);

function solve($a,$b,$c,$d){
    $MPoints = max($a*3/10,$a-$a/250*$c);
    $VPoints = max($b*3/10,$b-$b/250*$d);
    if($MPoints>$VPoints){
        echo "Misha";
    }else if($MPoints<$VPoints){
        echo "Vasya";
    }else if($MPoints ==$VPoints){
        echo "Tie";
    }
}

solve($a,$b,$c,$d);

?>


<?php
// for example, the input is '5 9'
$input = trim(fgets(STDIN));

function magicNumber($input){
	$numbers = str_split($input);
	foreach($numbers as $key => $number){
		if(!in_array($number, [1,4])){
			return false;
		}
		if($number == 4){
			if($key == 0){
				return false;
			}
			if($numbers[$key-1] == 1){
				continue;
			}elseif($numbers[$key-1] == 4){
				if($numbers[$key-2] == 1)
					continue;
				else
					return false;
			}

		}
	}
	return true;
}
if(magicNumber($input)){
	echo "YES";
}else{
	echo "NO";
}


<?php
function main(){
    $arr=["Danil","Olya","Slava","Ann","Nikita"];
    fscanf(STDIN,"%s",$x);

    foreach($arr as $s){
        $cnt+=preg_match_all("/$s/",$x);
    }
    if($cnt==1)echo "YES";
    else echo "NO";
}
main();


<?php

list ($n1, $n2) = explode(" ", fgets(STDIN));
if ($n2 >= $n1)
{
    echo "Second\n";
}
else
{
    echo "First\n";
}


<?php
$fi=@fopen('test.inp',"r");
list($n1,$n2,$k1,$k2)=explode(" ",trim(fgets(STDIN)));
if ($n1>$n2) echo "First";
else echo "Second";
?>


         <?php
  $fr = fopen("php://stdin", "r");
  $fw = fopen("php://stdout", "w");

  fscanf($fr, "%s", $r1);
  fscanf($fr, "%s", $r2);
   date_default_timezone_set("America/Los_Angeles");
   $s=  strtotime("+$r2 minutes",  strtotime($r1));

 fprintf($fw, date('H:i' , $s));

  fclose($fr);
  fclose($fw);
?>


<?php
$t = (int)fgets(STDIN);
for ($i = 0; $i < $t; $i += 1) {
    $flag = false;
    $x = (int)fgets(STDIN);
    for ($j = 0; $j <= $x; $j +=7) {
        if (($x - $j) % 3 === 0) {
            echo "YES\n";
            $flag = true;
            break;
        }
    }
    if (! $flag) echo "NO\n";
}


<?php

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

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


<?php
list($n,$k) = explode(' ', trim(fgets(STDIN)));
for ($i = 1; $i <= $n; $i++){
    $iV = $n - $i;
    $iSum = $i*($i + 1)/2;
    if($iSum - $iV == $k){
        echo $iV;
        break;
    };
}


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
if($a == $b)
{
     print "Yes";
}
else
{
     print "No";
}
?>


<?php

$n = trim(fgets(STDIN));
$m = trim(fgets(STDIN));

if($n>=27){
    print $m;
}
else print ($m % (1<<$n));

?>


<?php

fgets(STDIN);
$numbers = fgets(STDIN);
$numbers = explode(' ', trim($numbers));
$numbers = array_unique($numbers);

if (count($numbers) > 3) {
    echo -1;
    die;
}

$numbers = array_map('intval', $numbers);
sort($numbers);

$numbers = array_values($numbers);

$d = -1;
switch (count($numbers)) {
    case 1:
        $d = 0;
        break;
    case 2:
        $diff = $numbers[1] - $numbers[0];
        if ($diff % 2) {
            $d = $diff;
        } else {
            $d = $diff / 2;
        }
        break;
    case 3:
        if (($numbers[2] - $numbers[1]) !== ($numbers[1] - $numbers[0])) {
            $d = -1;
        } else {
            $d = $numbers[2] - $numbers[1];
        }
        break;
}

if ($d < -1) {
    $d = -1;
}

echo $d;


<?php
list($n, $k) = explode(' ',trim(fgets(STDIN)));

if($k / $n >= 3) print 0; else print $n - $k + $n * 2;
?>


<?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) ;
    }

?>


<?php
$num = fgets(STDIN);
$times = array();
for ($i=0;$i<4;++$i) {
  $line = fgets(STDIN);
  for ($j=0;$j<4;++$j) {
    if ($line[$j] !== '.') {
      $times[$line[$j]]++;
    }
  }
}
sort($times);
print $times[count($times)-1] <= $num * 2 ? 'YES' : 'NO';


<?php
     $n = explode(" ", trim(fgets(STDIN)));
     echo min(max(1,$n[1]),$n[0]-$n[1]);
?>


<?php

$line = fgets(STDIN);

sscanf($line, '%d %d', $a, $b);

function f($a, $b) {
    if ($b == 0) {
        return 1;
    }
    $out = $a - $b;
    return min($out, $b);
}

echo f($a, $b);


<?php
list($f, $nf) = explode(' ', trim(fgets(STDIN)));
$h = $f;
while($f>=$nf){
    $nh = floor($f/$nf);
    $rf = $f%$nf;
    $h += $nh ;
    $f = $nh + $rf;
}
echo $h;


<?php
function _calc($a){
    $arr = array(2,7,2,3,3,4,2,5,1,2);
    return $arr[$a];
}
$in = trim(fgets(STDIN));
echo (_calc($in[0])*_calc($in[1]));
?>


<?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;
    }
}
?>


<?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";

?>


<?php
list ($a, $b, $s) = explode(" ", trim(fgets(STDIN)));

$min = abs($a) + abs($b);
if ($s < $min) {
  echo "No\n";
} else {
  $diff = $s - $min;
  if ($diff % 2 == 0) {
    echo "Yes\n";
  } else {
    echo "No\n";
  }
}


<?php
    fscanf(STDIN, "%d %d", $x, $y);
    fscanf(STDIN, "%d %d", $x1, $y1);
    if(abs($y1 - $y) > abs($x1 - $x)) print abs($y1 - $y);
    else print abs($x1 - $x);
?>


<?php
$line1 = explode(' ', trim(fgets(STDIN)));
$n = $line1;
$ch = 81;
$way = array();
function back($ch){
    global $line1, $way;
    if($ch < $line1[0]){
        echo "NO";
        return;
    }
    if($ch == $line1[0]){
        array_push($way, $ch);
        sort($way);

        echo "YES".PHP_EOL;
        echo count($way).PHP_EOL;
        foreach($way as $key =>$item){
            if($key == count($way)-1){
                 echo $item;
                break;
            }
            echo $item.' ';
        }
        return;
    }
    if($ch % 10 == 1){
        array_push($way, $ch);
        return back(substr($ch, 0, -1));
    }else if($ch % 2 == 0){
        array_push($way, $ch);
       return back($ch/2);
    }else{
        echo "NO";
        return;
    }
}
back($line1[1]);


<?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';
    }
?>


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = explode(" ", trim(fgets(STDIN)));
array_unshift($c, " ");
unset($c[0]);
$g = 0;
for($x = 1; $x <= $a; $x++)
{
     $d = $c;
     $e = $x;
     unset($d[$e]);
     while(TRUE)
     {
          $e -= $b;
          if($e <= 0)
          {
               break;
          }
          else
          {
               unset($d[$e]);
          }
     }
     $e = $x;
     while(TRUE)
     {
          $e += $b;
          if($e > $a)
          {
               break;
          }
          else
          {
               unset($d[$e]);
          }
     }
     $f = abs(array_sum($d));
     $g = max($g, $f);
}
print $g;
?>


<?php
list($n, $k) = explode(" ", trim(fgets(STDIN)));

$tabs = explode(" ", trim(fgets(STDIN)));

$t = 0;
for ($i = 0; $i < $n; $i++) {
    if ($tabs[$i] == 1) {
        $t++;
    }
}

$social = $n - $t;

$max = 0;

for ($i = 0; $i < $k; $i++) {
    $closed_s = 0;
    $closed_t = 0;

    for ($j = $i; $j < $n; $j += $k) {
        if ($tabs[$j] == 1) {
            $closed_t++;
        } else {
            $closed_s++;
        }
    }
    $e = $t - $closed_t;
    $s = $social - $closed_s;
    if ($max < abs($e - $s)) {
        $max = abs($e - $s);
    }
}

echo $max;


<?php
$f = fopen( 'php://stdin', 'r' );

while( $line = fgets( $f ) ) {

  echo floor($line/2) +1;

}

fclose( $f );
?>


<?php

$stdin = fopen('php://stdin', 'r');
$data = explode(" ", trim(fgets($stdin)));
$n = $data[0]; $k = $data[1];
$part = ceil($n/2);
if($k > $part)
{
    echo 2 * ($k-$part);
}
 else {
    echo 2*($k-1)+1;
}


<?php
$line = trim(fgets(STDIN));
$pieces = explode(" ", $line);
$w = $pieces[0];
$h = $pieces[1];
$k = $pieces[2];

$sum = $w*2+($h-2)*2;

for($i=1;$i<$k;$i++) {
	$w=$w-4;
	$h=$h-4;
	$inner = $w*2+($h-2)*2;
	$sum += $inner;
}

echo $sum;

/*
if($num1*$num2 == $num3) {
	echo "Yes".PHP_EOL;;
	echo $num1.' '.$num2.' '.$num3;
}
else if($num2*$num3 == $num1) {
	echo "Yes".PHP_EOL;;
	echo $num2.' '.$num3.' '.$num1;
}
else if($num3*$num1 == $num2) {
	echo "Yes".PHP_EOL;;
	echo $num3.' '.$num1.' '.$num2;
} else {
	echo "No";
}*/

?>


<?php

    $stdin = fopen('php://stdin', 'r');
    $string = trim(fgets($stdin));
    $arr = explode(" ", $string);
    sort($arr);
    $triang = is_triangle($arr[0], $arr[1], $arr[2]) || is_triangle($arr[1], $arr[2], $arr[3]);
    $segment = is_segment($arr[0], $arr[1], $arr[2]) || is_segment($arr[1], $arr[2], $arr[3]);
    if ($triang) {
        echo 'TRIANGLE';
    } elseif ($segment) {
        echo 'SEGMENT';
    } else {
        echo 'IMPOSSIBLE';
    }

function is_triangle($a, $b, $c) {
    return $a + $b > $c;
}

function is_segment($a, $b, $c) {
    return $a + $b == $c;
}


<?php
function input()
{
    return rtrim(fgets(STDIN));
}

function input_array()
{
    return explode(' ', input());
}

$num = input_array();
sort($num);
if ($num[0] + $num[1] > $num[2] || $num[1] + $num[2] > $num[3]) echo "TRIANGLE\n";
else if($num[0] + $num[1] == $num[2] || $num[1] + $num[2] == $num[3]) echo "SEGMENT\n";
else echo "IMPOSSIBLE\n";
?>


<?php
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
$val = 0;
$counter = 1;
while($val<intval($line)) {
    $val = ($counter*($counter+1))/2;
    $counter++;
}
if ($val == intval($line)) {
    print 'YES';
} else {
    print 'NO';
}


<?php
$a = trim(fgets(STDIN));
$b = explode(" ", trim(fgets(STDIN)));
$c = max($b);
if($c > 25)
{
     print $c - 25;
}
else
{
     print "0";
}
?>


<?php
$h = fopen("php://stdin", "r");

$line=trim(fgets($h));
$line_arr=explode(' ', $line);
$a=trim($line_arr[0]);
$b=trim($line_arr[1]);

if($a==$b)
	echo $a;
else
	echo 1;


<?php
// http://codeforces.com/problemset/problem/691/A
$handle = fopen ("php://stdin", "r");
fscanf($handle, "%i",$n);
$arr_temp = fgets($handle);
$arrInput = explode(" ",$arr_temp);
$arr = array_map('intval', $arrInput);

$maxWait = 15;
foreach ($arr as $interestMin) {
	if($interestMin > $maxWait){
		echo $maxWait;die;
	}else{
		$maxWait = $interestMin + 15;
	}
}
echo $maxWait > 90 ? 90 : $maxWait;

?>


<?php

$h = fopen ("php://stdin","r");

$n = (int)fgets($h);
$m = (int)fgets($h);

$max = -1;
$list = [];

for ($i = 0; $i < $n; $i++) {

    $int = (int)fgets($h);
    $list[] = $int;

    if ($int >= $max) {
        $max = $int;
    }
}

$count = $m;
$maxCount = 0;

while($count > 0 && $maxCount < $n)
{
    $maxCount = 0;

    for($i = 0; $i < $n && $count > 0; $i++)
    {
        if($list[$i] < $max)
        {
            $list[$i]++;
            $count--;
        }
        else
        {
            $maxCount++;
        }
    }
}

echo $max + ceil($count / $n), ' ', $max + $m;


<?php
$f = fopen( 'php://stdin', 'r' );

$counter = 0;
while( $line = fgets( $f ) ) {
  if ($counter == 1) {
      $nutsLine = $line;
  }
  $counter ++ ;
}

$nuts = explode(' ', $nutsLine);
$length = sizeof($nuts);
$vars = 0;
$countMode = false;
$tempVars = 0;
$zero = true;
foreach($nuts as $nut) {
    if ($nut == 1) {
        $zero = false;
    }
}
if ($zero) {
    echo '0';
    die();
}
for($i=0; $i < $length; $i++) {
    if (!$countMode && ($nuts[$i] == '1')) {
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
    }

    if ($countMode && ($nuts[$i] == 1)) {
        if ($tempVars > 0) {
            $tempVars ++;
            if ($vars > 0) {
                $vars = $vars * $tempVars;
            } else {
                $vars = $tempVars;
            }
            $tempVars = 0;
        } else {

        }
    }

}
if ($vars == 0) {
    echo '1';
} else {
    echo number_format($vars, 0, '', '');
}

?>


<?php
error_reporting(0);
$dir = fopen("php://stdin", 'r');
$datatxt = stream_get_contents($dir);
// $datatxt = "1000000000 1000000000 1";
$text = explode(" ",$datatxt);
$total= 0;
for($i=0;$i<5;$i++){
$total+=$text[$i];
}
$initial = $total/5;
if (($total%5)==0 && $initial>0){
echo $initial;
}else {
echo "-1";
}
?>


<?php

$data = explode(' ', trim(fgets(STDIN)));

$n = $data[0];
$m = $data[1];
$r = $data[2];

$s = explode(' ', trim(fgets(STDIN)));
$b = explode(' ', trim(fgets(STDIN)));

$min = min($s);

$ans = $r - $min*floor($r/$min) + max($b)*floor($r/$min);

echo ($ans > $r ? $ans : $r);


<?php
  $n = explode(" ", trim(fgets(STDIN)));
  $m = explode(" ", trim(fgets(STDIN)));
  $z = explode(" ", trim(fgets(STDIN)));

 $min = min($m);
 $max = max($z);
 if ($max <= $min) {
     echo $n[2];
     exit;
 } else {
     $q = floor($n[2] / $min) * $max;
     $q = $q + ($n[2] % $min);
     echo $q;
     exit;
 }

?>


<?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 readString() {$d = trim(fgets($this->_fh));return $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;}
}

/* Perform action N times. Can return values in array */
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. */
function cumsum(&$a){$sum = 0;foreach($a as $k=>$v) {$a[$k] += $sum;$sum = $a[$k];}}

/* Difference. Keys preserved. By reference. */
function diff(&$a){$prev = 0;foreach($a as $k=>$v) {$buf=$a[$k];$a[$k]-=$prev;$prev = $buf;}}

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 */

$n = $ir->readInt();

$k = intval(sqrt($n));

if ($n==$k*$k) {
	echo $k+$k;
} else if ($n<=$k*($k+1)) {
	echo $k+$k+1;
} else {
	echo $k+$k+2;
}


<?php

$stdin = fopen("php://stdin", "r");
fscanf($stdin, "%d\n", $ar_count);
fscanf($stdin, "%[^\n]", $first);
fscanf($stdin, "%[^\n]", $second);

$first = explode(' ', $first);
$second = explode(' ', $second);

if (array_sum($first) >= array_sum($second)) {
    echo 'Yes';
} else {
    echo  'No';
}


<?php

$input;
$buffer = Array();
init();

function getNext() {
  global $buffer;
  if( count($buffer) > 0 ) {
    return array_shift($buffer);
  }
  $line = preg_replace('/[\\r\\n]+$/', '', getLine());
  $buffer = preg_split('/\\s+/', $line);
  return getNext();
}

function getLine() {
  global $input;
  return fgets($input, 4096);
}

function init() {
  global $input;
  $input = fopen("php://stdin", "r");
}

function main() {

  $target = preg_split('/\\./', getNext());
  $self = getNext();

  $cand = preg_split('/\\./', $self);

  $ans = (ok(intval($cand[0]), intval($cand[1]), intval($cand[2]), $target) ||
          ok(intval($cand[0]), intval($cand[2]), intval($cand[1]), $target) ||
          ok(intval($cand[1]), intval($cand[0]), intval($cand[2]), $target) ||
          ok(intval($cand[1]), intval($cand[2]), intval($cand[0]), $target) ||
          ok(intval($cand[2]), intval($cand[0]), intval($cand[1]), $target) ||
          ok(intval($cand[2]), intval($cand[1]), intval($cand[0]), $target));

  print ($ans ? "YES" : "NO") . "\n";

}

function validDate($dd, $mm, $yy) {
  $days = ($yy % 4 == 0 ? Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) : Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
  if( $mm > 12 ) { return false; }
  $max = $days[$mm-1];
  return ($dd <= $max);
}

function ok($dd, $mm, $yy, $target) {
  if( !validDate($dd, $mm, $yy) ) { return false; }
  $me = $dd + $mm * 100 + ($yy + 18) * 10000;
  $you = $target[0] + $target[1] * 100 + $target[2] * 10000;
  return $me <= $you;
}

main();

?>


<?php

//fscanf(STDIN, "%d", $t);
$values = array_map('intval', explode(' ',trim(fgets(STDIN))));
$r = $values[0];
$x = $values[1];
$y = $values[2];
$x1 = $values[3];
$y1 = $values[4];

$res = 0;
$dist = sqrt(pow($x-$x1,2) + pow($y-$y1,2));
while($dist > 0){
    $dist -= 2*$r;
    $res++;
}

echo $res."\n";


<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = 0;
$d = 1;
while(TRUE)
{
     if($a < 0)
     {
          print "Vladik";
          break;
     }
     elseif($b < 0)
     {
          print "Valera";
          break;
     }
     else
     {
          $e = $c % 2;
          if($e == 0)
          {
               $a -= $d;
          }
          else
          {
               $b -= $d;
          }
          $c++;
          $d++;
     }
}
?>


<?php

class AccumulationOfDominoes
{
    public static function Solution(){
        $input = readline();
        $array = explode(' ', $input);
        $n = (int)$array[0];
        $m = (int)$array[1];

        if ( $m == 1)
            echo $n - 1;
        else
            echo $n * ($m - 1);
    }
}

AccumulationOfDominoes::Solution();


<?php
$nb = explode(" ",trim(fgets(STDIN)));
$n = $nb['0'];
$b = $nb['1'];
$digits = explode(" ",trim(fgets(STDIN)));
$rtl_digits = array_reverse($digits);
$sum1=0;
for($i=0;$i<$n;$i++)
    {
       $sum1 += ($rtl_digits[$i])*(pow($b,$i));
    }

$mc=explode(" ",trim(fgets(STDIN)));
$m = $mc['0'];
$c = $mc['1'];
$digit = explode(" ",trim(fgets(STDIN)));
$rtl_digit = array_reverse($digit);
$sum2=0;
for($j=0;$j<$m;$j++)
    {
       $sum2 += ($rtl_digit[$j])*(pow($c,$j));
    }
if($sum1>$sum2)echo ">";
if($sum1<$sum2)echo "<";
if($sum1==$sum2)echo "=";

?>


<?php
$input = explode(" ", trim(fgets(STDIN)));
$n = $input[0];
$m = $input[1];

$step = (int)($n/2 + $n%2);
while ($step <= $n && $step%$m != 0) {
    $step++;
}
echo ($step>$n) ? -1 : $step;
?>


<?php
fscanf(STDIN, "%s", $str);
echo preg_match_all("/(C{1,5})|(P{1,5})/", $str, $matchesarray);


<?php
$a = str_split(trim(fgets(STDIN)));
$b = array_unique($a);
$c = array_keys($b);
$d = array();
for($x = 0; $x < count($b); $x++)
{
     $d[$x] = $b[$c[$x]];
}
$e = implode($d);
$f = "abcdefghijklmnopqrstuvwxyz";
$g = substr($f, 0, strlen($e));
if($e == $g)
{
     print "YES";
}
else
{
     print "NO";
}
?>


<?php
    $word = trim(fgets(STDIN));
    $arr = str_split($word);
    $used = array();

    for($i=sizeof($arr)-1; $i>=0; $i--)
    {
        $flag = false;
        if($arr[$i]!='a')
        {
            for($j=$i-1; $j>=0; $j--)
            {
                $buffer = $arr[$j];
                ++$buffer;

                if( $arr[$i] == $buffer)
                {
                    $flag = true;
                    break;
                }
            }
            if(!$flag)
            {
                $ans = 'no';
                break;
            }
        }
    }

    echo ($ans == 'no') ? "NO\n" : "YES\n";
?>


<?php
while($f = fgets(STDIN)){
$numb = explode(" ", $f);
}

$start = $numb[0];
$stop = $numb[1];
$count = 0;
$number = 1;

for ( $i = 0; $i < 32; $i++) {
for ( $j = 0; $j < 20; $j++) {
$tmp = (pow(2, $i)) * pow(3, $j);
if($start <= $tmp && $tmp <= $stop) $count++;
}
}
echo $count;
?>


<?php
/*
NYQAHBYYOXLTRYQDMVENEMAQNBAKGLGQOLXNAIFNQTOCLNNQIA
 */
$n = intval(trim(fgets(STDIN)));
$line = trim(fgets(STDIN));
function count_substr($s, $sub){
    $ret = 0;
    $len = strlen($s) ;
    for($i =0; $i < $len - 1; $i++){
        if($s[$i] == $sub[0] && $s[$i+1] == $sub[1])
            $ret++;
    }
    return $ret;
}
$max = -1;
$max_sub = "";
for($c = ord('A'); $c <= ord('Z'); $c++){
    for($k=ord('A'); $k <=ord('Z'); $k++){
        $tmp = chr($c).chr($k);
//        var_dump($tmp . PHP_EOL);
        $count = count_substr($line,$tmp);
//        var_dump($count);
        if($count > $max){
            $max = $count;
            $max_sub = $tmp;
        }
    }
}
echo $max_sub . PHP_EOL;
exit;


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


<?php
// Retrieve input and show output
$stream = fopen("php://stdin", "r");
$input = stream_get_contents($stream);
$inputs = preg_split("/[\s]+/", $input);
echo func($inputs);

// Codeforces Contest 123 Division 2 Problem A
function func($in) {
$tot = ($in[0] * $in[2]) / $in[1];
$dl = (is_int($tot)) ? $tot : round($tot + 0.5);
return $dl - $in[2];
}

// End of submission file
// Submission by chaotic_iak
?>


<?php

function allDoorPossibleToOpen($input)
{
    $line = explode("\n", $input);
    $testCase = $line[0];

    for ($i = 1; $i <= $testCase; $i++) {

        $keyOnHand = $line[$i*2-1];
        $keyBehindDoor = explode(" ",$line[$i*2]);
        for($openedDoor = 1; $openedDoor <= 3; $openedDoor++){
            $keyOnHand = $keyBehindDoor[$keyOnHand-1];
            if($keyOnHand == 0){
                break;
            }
        }
        if($openedDoor == 3){
            echo "YES\n";
        }else{
            echo "NO\n";
        }
    }
}

allDoorPossibleToOpen(file_get_contents('php://stdin'));


<?php

$a = trim(fgets(STDIN));
//$a = "codeforces";

$input = $a;
$input = str_split($input);
$ok = true;

for($i = 0; $i < sizeof($input); $i++){
    $value = $input[$i];
     if(!isVowel($value) && $value != 'n'){
         //if not n or vowel, have to check the next char
         if($i + 1 >= sizeof($input)){
             $ok = false;
             break;
         }else if(!isVowel($input[$i+1])){
             $ok = false;
             break;
         }
     }
}

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

function isVowel($character){
    return $character == 'a'
    || $character == 'i'
    || $character == 'u'
    || $character == 'e'
    || $character == 'o';
}
?>


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


<?php
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
list($n, $t, $k, $d) = explode(" ", $line);
    //8 6 4 5
    //4 2 1 4

$one_oven_rounds = ceil($n/$k);
$one_oven_time = $one_oven_rounds*$t;

$oven1_rounds_while_building = floor((int)$d/(int)$t);

$two_oven_time = max($oven1_rounds_while_building*$t,(int)$d) + ceil(($one_oven_rounds-$oven1_rounds_while_building)/2)*$t; //one round can be done during building the oven

if($two_oven_time < $one_oven_time){
	echo "Yes";
}else{
	echo "No";
}


<?php
list ($L, $n1, $n2, $n3) = explode(" ", trim(fgets(STDIN)));
$parts = Array($n1, $n2, $n3);
sort($parts);
function f($x, $N, $L)
{
    global $CACH, $parts;
    $CACH[$x] = $N;
    foreach ($parts as $part)
        if (($CACH[$x + $part] < $N + 1) && ($x + $part <= $L)) {
            f($x + $part, $N + 1, $L);
        }
}
f(0, 0, $L);
echo $CACH[$L];

?>


<?php

$input_desc = fopen("php://stdin", "r");

$first_string = trim(fgets($input_desc));

fclose($input_desc);

$numbers = explode(' ', $first_string);

$numbers = array_filter(array_map('trim', $numbers));

$distance = (int)array_pop($numbers);

define('RIGHT_BORDER', 10 ** 9);

if ($numbers[0] - $numbers[1] >= $distance
    && $numbers[1] - $numbers[2] >= $distance
    && $numbers[2] - $numbers[0] >= $distance) {
    echo 0;
    exit();
}

$left = min($numbers);
$right = max($numbers);
if ($right === $left) {
    $middle = $left;
} else {

    $middle = false;

    foreach ($numbers as $number) {
        if ($number < $right && $number > $left) {
            $middle = $number;
        }
    }
    if ($middle === false) {
        $right_keys = array_keys($numbers, $right);
        if (count($right_keys) > 1) {
            $middle = $right;
        } else {
            $middle = $left;
        }
    }
}

$current_left_distance = $middle - $left;
$current_right_distance = $right - $middle;

$result = 0;
if ($current_left_distance < $distance) {
    $result += $distance - $current_left_distance;
}
if ($current_right_distance < $distance) {
    $result += $distance - $current_right_distance;
}
echo $result;
exit;


<?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);
}