When preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked $$$n$$$ people about their opinions. Each person answered whether this problem is easy or hard.If at least one of these $$$n$$$ people has answered that the problem is hard, the coordinator decides to change the problem. For the given responses, check if the problem is easy enough.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of people who were asked to give their opinions. The second line contains $$$n$$$ integers, each integer is either $$$0$$$ or $$$1$$$. If $$$i$$$-th integer is $$$0$$$, then $$$i$$$-th person thinks that the problem is easy; if it is $$$1$$$, then $$$i$$$-th person thinks that the problem is hard.

Print one word: "EASY" if the problem is easy according to all responses, or "HARD" if there is at least one person who thinks the problem is hard.  You may print every letter in any register: "EASY", "easy", "EaSY" and "eAsY" all will be processed correctly.

NoteIn the first example the third person says it's a hard problem, so it should be replaced.In the second example the problem easy for the only person, so it doesn't have to be replaced.

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

if ( in_array(1, $opinions) ) {
    echo "HARD\n";
} else {
    echo "EASY\n";
}

<?php
$w=intval(fgets(STDIN));
$ar=explode(' ',fgets(STDIN));
$i = 0;
$res = "EASY";
while ($i<$w) {
    if($ar[$i] > 0){
        $res = "HARD";
    break;
    }
    $i++;
}
echo $res;
?>

<?php
$w=intval(fgets(STDIN));
$st=fgets(STDIN);
$res = strstr($st, "1") ? "HARD" : "EASY";
echo $res;
?>

<?php

$input = STDIN;
$output = STDOUT;

fgets($input);

$ni = explode(' ', fgets($input));

fwrite($output, in_array(1, $ni) ? 'HARD' : 'EASY');

<?php
while(! feof(STDIN)){
   $var[]=fgets(STDIN);
}

$value = explode(" ", $var[1]);

$f=0;
for($i=0; $i < $var[0]; $i++){
    if($value[$i]==1 && $f!=1){echo "hard"; $f=1;}
}
if($f!=1)
echo "easy";

fclose(STDIN);

?>

<?php
    $n = trim(fgets(STDIN));
    $answers = explode(' ', trim(fgets(STDIN)));
    $isHard = false;
    foreach ($answers as $answer) {
        if ($answer == "1") {
            $isHard = true;
        }
    }
    echo $isHard ? "HARD" : "EASY";

<?php
$n = readline();
$a = explode(' ', readline());
if (in_array('1', $a)) {
  echo "HARD\n";
}
else {
  echo "EASY\n";
}

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

$i = trim(fgets(STDIN));

$arr = explode(' ', $i);
$par = 0;

foreach ($arr as $value) {
  if($value == 1){
    echo 'HARD';
    break;
  }else{
    $par = 1 + $par;
  }
}

if($par == $n){
  echo 'EASY';
}

 ?>

<?php
/* $inputs = [];
foreach($data as $k => $d) {
    echo $k;
    $inputs = array_merge($inputs, $data[$k]);
} */

$stdin = fopen('php://stdin', 'r');
while($line = fgets($stdin)) {
    $line = explode(" ", $line);
    $data[] = $line;
}
fclose($stdin);

list($n, $i) = $data;

if (in_array(1, $i)) {
    echo "HARD";
} else {
    echo "EASY";
}

<?php
/* $inputs = [];
foreach($data as $k => $d) {
    echo $k;
    $inputs = array_merge($inputs, $data[$k]);
} */

// // // STANDARD INPUT DEFINITION // // //
$stdin = fopen('php://stdin', 'r');
while($line = fgets($stdin)) {
    $data[] = explode(" ", $line);
}
fclose($stdin);

// // // DEFINE VARIABLES HERE (1 input line = 1 variable) // // //
list($a, $b) = $data;

// // // START CODING LOGIC HERE // // //
if (in_array(1, $b)) {
    echo "HARD";
} else {
    echo "EASY";
}

<?php
fscanf(STDIN,"%d",$n);
$a=explode(' ',trim(fgets(STDIN)));
foreach($a as $i)
{
    if($i==1)
    {
        echo "HARD";
        return 0;
    }
}
echo "EASY";
?>

<?php
fscanf(STDIN,"%d",$n);
$line=trim(fgets(STDIN));
$singleValue=explode(" ", $line);
$count=0;
for($i=0;$i<$n;$i++)
{
	if($singleValue[$i]==1)
	{
		echo "HARD";
		$count=1;
		break;

	}

}
if($count==0)
echo "EASY";

<?php

$n = trim(fgets(STDIN));

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

foreach($responses as $resp){
    if($resp==1){
        print("HARD");
        return;
    }
}

print("EASY");

<?php
    $n=trim(fgets(STDIN));
    $a=explode(' ',trim(fgets(STDIN)));
    for($i=0;$i<$n;$i++){
        $s+=$a[$i];
    }
    if($s>0) echo 'HARD';
    else echo 'EASY';

<?php
error_reporting(0);
$handle = fopen("php://stdin", "r");
$data = explode("\n", stream_get_contents(fopen("php://stdin", "r")));
$input = [];

foreach ($data as $index => $line) {
    if (strlen($line) > 0) {
        $input[$index] = explode(" ", trim($line));
    }
}

echo in_array("1", $input[1], false) ? 'HARD': 'EASY';

<?php
fscanf(STDIN, "%d", $n);
$a = explode(" ", trim(fgets(STDIN)));
if (in_array(1, $a))
    echo "HARD";
else
    echo "EASY";
?>

<?php
error_reporting(0);
$n=readline();
$k=explode(' ',readline());
if(in_array('1',$k))
{
    echo 'HARD';
}
else
{
    echo 'EASY';
}
?>

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

for ($i = 0; $i < $n; $i++) {
  if ($input[$i] == 1) {
    echo "hard";
    exit();
  }
}

echo "easy";

?>

<?php
	$n = readline();
	$answers = explode(' ', readline());
	$check = 1;

	for ($i = 0; $i < $n; $i++) {
	    if ($answers[$i] == 0) {
	        $check *= 1;
	    } else {
	        $check *= 0;
	    }
	}

	if ($check) {
	    echo 'easy';
	} else {
	    echo 'hard';
	}
?>

<?php

$a = trim(fgets(STDIN));
$b = explode(" ",  trim(fgets(STDIN)));
$c = "easy";

foreach ($b as $value) {
	if ($value == 1) {
		$c = "HARD";
		break;
	}
}
echo $c;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

class stdIn{var $ntxt = 0;var $nline = 0;var $arr_txt;var $arr_line;var $linex;var $liney;
    function stdIn($local = false){if($local){$dir = fopen("input.txt", 'r');}else{$dir = fopen("php://stdin", 'r');}
        $datatxt = stream_get_contents($dir);$del = Array("\n","\r","\n\r");$data = explode("\n",$datatxt);	$il = 0;$id = 0;
        foreach($data as $line){if(strlen($line) > 0){$line = str_replace($del,'',$line);$dataex[] = $line;$text = explode(" ",$line);
            foreach($text as $txt){$arr_txt[] = $txt;$this->linex[$id] = $il;$this->liney[$il] = $id;$id++;}}$il++;}$this->arr_line = $dataex;$this->arr_txt  = $arr_txt;}
    function G(){$ret = $this->arr_txt[$this->ntxt++];$this->nline = $this->linex[$this->ntxt];return $ret;}
    function GL(){$this->ntxt = $this->liney[$this->nline]+1;return $this->arr_line[$this->nline++];}} /*init*/

$inp = new stdIn(false);
$n = $inp->arr_line[0];
$a = explode(' ',$inp->arr_line[1]);
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
error_reporting(0);
$a = readline();
$b=explode(" ",readline());
$one =array_count_values($b);
if ($one[1] != 0)
{
	echo "Hard";
}
else
{
	echo "Easy";
}
?>

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

<?php
ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d", $n);
$a = explode(" ", trim(fgets(STDIN)));

echo array_sum($a) > 0 ? "HARD" : "EASY";

<?php
    fgets(STDIN);
    $a = explode(" ", trim(fgets(STDIN)));
    print(in_array("1",$a)?"HARD":"EASY");
?>

<?php
$n=(int)readline();
$s=readline();
$arr=explode(' ',$s);
$i=0;
$r=0;
while($i!=$n){
    if($arr[$i]==1){
        $r=1;
        break;
    }
    else{
        $i++;
    }
}
if($r==1)
echo "HARD";
else{
    echo "EASY";
}

<?php
    function getData () {
        return file('php://stdin', FILE_IGNORE_NEW_LINES);
    }
    $result = 'EASY';
    $data = getData();
    $person = $data[0];
    $personAns = explode(' ', $data[1]);
    foreach ($personAns as $value) {
        if ((int)$value === 1) {
            $result = 'HARD';
            break;
        }
    }
    echo $result;
?>

<?php

$count = trim(fgets(STDIN));
$array = explode(' ', trim(fgets(STDIN)));

for ($i = 0; $i < $count; $i++) {
    if ($array[$i] != 0) {
        echo "HARD";die();
    }
}
echo "EASY";

<?php

   $p = fgets(STDIN);
   $o = explode(' ', fgets(STDIN));

   fwrite(STDOUT, array_sum($o) > 0 ? 'HARD' : 'EASY');

<?php

function search($str) {
  // code goes here
  return (strpos("0".$str, '1')) ? 'HARD' : 'EASY' ;
}

// keep this function call here
$file = fopen('php://stdin', 'r');
// $file = fopen('input.txt', 'r');
$num = fgets($file);
$str = fgets($file);
echo search($str);
?>

<?php
$x = readline();
$y = readline();
for($i=0; $i < strlen($y); $i++)
	if($y[$i] == '1')
    	die("HARD\n");
die("EASY\n");

<?php
$x = readline();
$y = readline();
$cndtn = 1;
for($i=0; $i < strlen($y); $i++)
	if($y[$i] == '1')
	{
		echo "HARD\n";
		$cndtn = 0;
		break;
	}
if($cndtn == 1)
	echo "EASY\n";

<?php
    fscanf(STDIN, "%d", $n);
    $k = 0;
    $arr = explode(" ", trim(fgets(STDIN)));
        for ($i = 0; $i < $n; $i++){
            if ($arr[$i] == 1){
                $k++;
            }
        }
        if ($k > 0){
            echo 'HARD';
        }
        else echo 'EASY';

<?php
    fscanf(STDIN, "%d", $n);
    $k = 0;
    $arr = explode(" ", trim(fgets(STDIN)));
        for ($i = 0; $i < $n; $i++){
            if ($arr[$i] == 1){
                $k++;
            }
        }
        if ($k > 0){
            echo 'HARD';
        }
        else echo 'YASY';

<?php
$w=intval(fgets(STDIN));
$st=fgets(STDIN);
$res = strpos($st, "1") ? "HARD" : "EASY";
echo $res;
?>

<?php
$w=intval(fgets(STDIN));
$st=fgets(STDIN);
if(strstr('1', $st)){
    $res = "HARD";
}else{
    $res = "EASY";
}
echo $res;
?>

<?php
$w=intval(fgets(STDIN));
$st=fgets(STDIN);
$res = strpos($st, "1") ? "HARD" : "EASY";
echo $res;
die;
?>

<?php
$w=intval(fgets(STDIN));
$ar=explode(' ',fgets(STDIN));
$i = 0;
$res = "EAZY";
while ($i<$w) {
    if($ar[$i] > 0){
        $res = "HARD";
    break;
    }
    $i++;
}
echo $res;
?>

<?php
while(! feof(STDIN)){
   $var[]=fgets(STDIN);
}

$value = explode(" ", $var[1]);

$f=0;
for($i=0; $i < $var[0]; $i++){
    if($value[$i]==1){echo "hard"; $f=1;}
}
if($f!=1)
echo "easy";

fclose(STDIN);

?>

n = int(input())
a = sum(map(int, input().split()))
if a > 0:
    print('HARD')
else:
    print('EASY')

<?php
/* $inputs = [];
foreach($data as $k => $d) {
    echo $k;
    $inputs = array_merge($inputs, $data[$k]);
} */

$stdin = fopen(STDIN, 'r');
while($line = fgets($stdin)) {
    $line = explode(" ", $line);
    $data[] = $line;
}
fclose($stdin);

print_r($data);

list($n, $i) = $data;

if (in_array(1, $i)) {
    echo "HARD";
} else {
    echo "EASY";
}

<?php
/* $inputs = [];
foreach($data as $k => $d) {
    echo $k;
    $inputs = array_merge($inputs, $data[$k]);
} */

$stdin = fopen('php://stdin', 'r');
while($line = fgets($stdin)) {
    $line = explode(" ", $line);
    $data[] = $line;
}
fclose($stdin);

print_r($data);

list($n, $i) = $data;

if (in_array(1, $i)) {
    echo "HARD";
} else {
    echo "EASY";
}

<?php

// $stdin = fopen("data/file.txt", 'r');
$stdin = file(STDIN);
// $stdin = file("data/file.txt");

foreach($stdin as $line) {
    $data[] = explode(" ", trim($line));
}

print_r($data);
list($n, $i) = $data;

if (in_array("1", $i)) {
    echo "HARD";
} else {
    echo "EASY";
}

<?php
    $n=trim(fgets(STDIN));
    for($i=0;$i<$n;$i++)$s+=(fgets(STDIN));
    if($s>0) echo 'HARD';
    else echo 'EASY';

<?php
    $a=trim(fgets(STDIN));
    $b=trim(fgets(STDIN));
    $c=trim(fgets(STDIN));
    if($a+$b+$c>0) echo 'HARD';
    else echo 'EASY';

<?php
    $n=trim(fgets(STDIN));
    for($i=0;$i<$n;$i++){
        $s+=fgets(STDIN);
    }
    if($s>0) echo 'HARD';
    else echo 'EASY';

<?php
    $n=trim(fgets(STDIN));
    for($i=0;$i<$n;$i++){
        $s+=trim(fgets(STDIN));
    }
    if($s>0) echo 'HARD';
    else echo 'EASY';

<?php
$handle = fopen ("php://stdin", "r");
// $line = explode(" ", trim(fgets($handle)));
$line = trim(fgets($handle));
fclose($handle);

$handle = fopen ("php://stdin", "r");
$line2 = explode(" ", trim(fgets($handle)));
fclose($handle);

echo in_array("1", $line2) ? 'HARD': 'EASY';

<?php
$handle = fopen ("php://stdin", "r");
// $line = explode(" ", trim(fgets($handle)));
$line = trim(fgets($handle));
fclose($handle);

$handle = fopen ("php://stdin", "r");
$line2 = explode(" ", trim(fgets($handle)));
fclose($handle);

echo in_array("1", $line2, false) ? 'HARD': 'EASY';

<?php
	$n = readline();
	$answers = explode(' ', readline());
	$check = 1;

	for ($i = 0; $i < $n; $i++) {
	    if ($answers[$i] == 0) {
	        $check *= 1;
	    } else {
	        $check *= 0;
	    }
	}

	if ($check) {
	    echo 'ease';
	} else {
	    echo 'hard';
	}
?>

<?php

$a = trim(fgets(STDIN));
$b = explode(" ",  trim(fgets(STDIN)));
$c = "easy";

foreach ($variable as $value) {
	if ($value == 1) {
		$c = "HARD";
		break;
	}
}
echo $c;

<?php

$a = trim(fgets(STDIN));
$b = explode(" ",  trim(fgets(STDIN)));
$c = "HARD";

foreach ($variable as $value) {
	if ($value == 0) {
		$c = "easy";
		break;
	}
}
echo $c;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =trim(fgets(STDIN));
var_dump($_POST);
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =fgets("php://input");
echo $str;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =file_get_contents("php://input");
echo $str;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =trim(fgets(STDIN));
echo $str;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =trim(fgets(STDIN));
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =trim(fgets(STDIN));
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        echo "HARD";
        die;
    }
}
echo "EASY";

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =fopen("php://stdin", 'r');
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =STDIN;
echo $str;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */
$str = fopen( 'php://stdin', 'r' );
// =trim(fgets(STDIN));
echo $str;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

//$str =trim(fgets(STDIN));
$str = "3
0 0 1";
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */
list($n, $k) = explode(' ', trim(fgets(STDIN)));
// =trim(fgets(STDIN));
echo $k;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =trim(file_get_contents (STDIN));
echo $str;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
/**
 * Created by PhpStorm.
 * User: Vitaly
 * Date: 22.01.2019
 * Time: 0:00
 */

$str =fopen("php://stdin", 'r');
echo $str;
$n = substr($str,0,1);
$a = explode(' ', substr($str,2));
$bool = "easy";
for($i=0;$i<$n;$i++){
    if(strval($a[$i])=="1"){
        $bool = "hard";
    }
}
echo $bool;

<?php
    function getData () {
        return file(__DIR__ . '/input.txt', FILE_IGNORE_NEW_LINES);
    }
    $result = 'EASY';
    $data = getData();
    $person = $data[0];
    $personAns = explode(' ', $data[1]);
    foreach ($personAns as $value) {
        if ($value == 1) {
            $result = 'HARD';
            break;
        }
    }
    echo '<br/>' . $result;
?>

<?php
    function getData () {
        return file(__DIR__ . '/input.txt', FILE_IGNORE_NEW_LINES);
    }
    $result = 'EASY';
    $data = getData();
    $person = $data[0];
    $personAns = explode(' ', $data[1]);
    foreach ($personAns as $value) {
        if ($value == 1) {
            $result = 'HARD';
            break;
        }
    }
    echo $result;
?>

<?php
    function getCountPersons () {
        return fgets(STDIN);
    }
    function getPersonAnwers () {
        return explode(' ', fgets(STDIN));
    }
    $result = 'EASY';
    $person = getCountPersons();
    $personAns = getPersonAnwers();
    foreach ($personAns as $value) {
        if ($value === 1) {
            $result = 'HARD';
            print $result;
            break;
        }
    }

<?php
    function getData () {
        return file_get_contents('php://stdin', FILE_IGNORE_NEW_LINES);
    }
    $result = 'EASY';
    $data = getData();
    $person = $data[0];
    $personAns = explode(' ', $data[1]);
    foreach ($personAns as $value) {
        if ($value == 1) {
            $result = 'HARD';
            break;
        }
    }
    echo $result;
?>

<?php
    function getData () {
        return file_get_contents('php://stdin', FILE_IGNORE_NEW_LINES);
    }
    $result = 'EASY';
    $data = getData();
    $person = $data[0];
    $personAns = explode(' ', $data[1]);
    foreach ($personAns as $value) {
        if ($value === 1) {
            $result = 'HARD';
            break;
        }
    }
    echo $result;
?>

<?php
    function getData () {
        return file('php://stdin', FILE_IGNORE_NEW_LINES);
    }
    $result = 'EASY';
    $data = getData();
    $person = $data[0];
    $personAns = explode(' ', $data[1]);
    var_dump($personAns);
    foreach ($personAns as $value) {
        if ((int)$value === 1) {
            $result = 'HARD';
            break;
        }
    }
    echo $result;
?>

<?php

$count = trim(fgets(STDIN));
$array = explode(' ', trim(fgets(STDIN)));

for ($i = 0; $i < $count; $i++) {
    if ($array[$i] !== 0) {
        echo "HARD";die();
    }
}
echo "EASY";

<?php

function search($str) {
  // code goes here
  return (strpos($str, '1')) ? 'HARD' : 'EASY' ;
}

// keep this function call here
$file = fopen('php://stdin', 'r');
// $file = fopen('input.txt', 'r');
$num = fgets($file);
$str = fgets($file);
echo search($str);
?>


You are given names of two days of the week.Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year.In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31.Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday".

The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday".

Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes).

NoteIn the second sample, one can consider February 1 and March 1 of year 2015. Both these days were Sundays.In the third sample, one can consider July 1 and August 1 of year 2017. First of these two days is Saturday, while the second one is Tuesday.

<?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 */
	$first = readString($f);
	$second = readString($f);

	$dayCount = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
	$firstIndex = array_search($first, $days);
	for ($m = 0; $m < 11; $m++) {
		$diff = $dayCount[$m] % 7;
		$next = ($firstIndex + $diff) % 7;
		if ($second == $days[$next]) {
			echo 'YES';
			return;
		}
	}
	echo 'NO';
	/* / end body */
}

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

<?php
$a = trim(fgets(STDIN));
$b = trim(fgets(STDIN));
if((($a == "monday") && ($b == "tuesday")) || (($a == "tuesday") && ($b == "wednesday")) || (($a == "wednesday") && ($b == "thursday")) || (($a == "thursday") && ($b == "friday")) || (($a == "friday") && ($b == "saturday")) || (($a == "saturday") && ($b == "sunday")) || (($a == "sunday") && ($b == "monday")))
{
     print "NO";
}
else
{
     print "YES";
}
?>


A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You should answer: will the flea visit all the hassocks or not. We assume that flea has infinitely much time for this jumping.

The only line contains single integer: 1 ≤ n ≤ 1000 — number of hassocks.

Output "YES" if all the hassocks will be visited and "NO" otherwise.

<?php
$a = trim(fgets(STDIN));
$b = range(1, $a);
$b = array_merge($b, $b);
$b = array_merge($b, $b);
$c = array();
$d = array();
$e = 0;
for($x = 1; $x <= 64; $x++)
{
    $c = array_merge($c, $b);
}
for($x = 0; $x < count($c); $x++)
{
    $e += $x;
    if($c[$e] == "")
    {
        break;
    }
    else
    {
        $d[$x] = $c[$e];
    }
}
$f = array_unique($d);
if(count($f) == $a)
{
    print "YES";
}
else
{
    print "NO";
}
?>

<?php
$a = trim(fgets(STDIN));
$b = range(1, $a);
$c = array();
$d = array();
$e = 0;
for($x = 1; $x <= 120; $x++)
{
    $c = array_merge($c, $b);
}
for($x = 0; $x < count($c); $x++)
{
    $e += $x;
    if($c[$e] == "")
    {
        break;
    }
    else
    {
        array_push($d, $c[$e]);
    }
}
$f = array_unique($d);
if(count($f) == $a)
{
    print "YES";
}
else
{
    print "NO";
}
?>

<?php
$a = trim(fgets(STDIN));
$b = range(1, $a);
$b = array_merge($b, $b);
$c = array();
$d = array();
$e = 0;
for($x = 1; $x <= 64; $x++)
{
    $c = array_merge($c, $b);
}
for($x = 0; $x < count($c); $x++)
{
    $e += $x;
    if($c[$e] == "")
    {
        break;
    }
    else
    {
        $d[$x] = $c[$e];
    }
}
$f = array_unique($d);
if(count($f) == $a)
{
    print "YES";
}
else
{
    print "NO";
}
?>

<?php
$a = trim(fgets(STDIN));
$b = range(1, $a);
$c = array();
$d = array();
$e = 0;
for($x = 1; $x <= 100; $x++)
{
    $c = array_merge($c, $b);
}
for($x = 0; $x < count($c); $x++)
{
    $e += $x;
    if($c[$e] == "")
    {
        break;
    }
    else
    {
        array_push($d, $c[$e]);
    }
}
$f = array_unique($d);
if(count($f) == $a)
{
    print "YES";
}
else
{
    print "NO";
}
?>


You're given a row with $$$n$$$ chairs. We call a seating of people "maximal" if the two following conditions hold:  There are no neighbors adjacent to anyone seated.  It's impossible to seat one more person without violating the first rule. The seating is given as a string consisting of zeros and ones ($$$0$$$ means that the corresponding seat is empty, $$$1$$$ — occupied). The goal is to determine whether this seating is "maximal".Note that the first and last seats are not adjacent (if $$$n \ne 2$$$).

The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of chairs. The next line contains a string of $$$n$$$ characters, each of them is either zero or one, describing the seating.

Output "Yes" (without quotation marks) if the seating is "maximal". Otherwise print "No". You are allowed to print letters in whatever case you'd like (uppercase or lowercase).

NoteIn sample case one the given seating is maximal.In sample case two the person at chair three has a neighbour to the right.In sample case three it is possible to seat yet another person into chair three.

<?php

$n = fgets(STDIN);
$str = fgets(STDIN);

$str = trim($str);

if ($n == 1 && $str[0] == '0') {
    fprintf(STDOUT, "No");
    return;
}

if ($n == 1 && $str[0] == '1') {
    fprintf(STDOUT, "Yes");
    return;
}

if ($str[strlen($str) - 1] == $str[strlen($str) - 2] && $str[strlen($str) - 1] == 0) {
    fprintf(STDOUT, "No");
    return;
}

if ($str[0] == $str[1] && $str[1] == 0) {
    fprintf(STDOUT, "No");
    return;
}

for($i=0;$i<strlen($str) - 1;$i++) {
    if ($str[$i] == $str[$i+1] && $str[$i] == 1) {
        fprintf(STDOUT, "No");
        return;
    }
}

for($i=0;$i<strlen($str) - 2;$i++) {
    if ($str[$i] == $str[$i+1] && $str[$i+1] == $str[$i+2] && $str[$i] == 0) {
        fprintf(STDOUT, "No");
        return;
    }
}

fprintf(STDOUT, "Yes");

<?php

$n = fgets(STDIN);
$str = fgets(STDIN);

if ($n == 1 && $str[0] == '0') {
    fprintf(STDOUT, "No");
    return;
}

if ($n == 1 && $str[0] == '1') {
    fprintf(STDOUT, "Yes");
    return;
}

if ($str[strlen($str) - 1] == $str[strlen($str) - 2] && $str[strlen($str) - 1] == 0) {
    fprintf(STDOUT, "No");
    return;
}

if ($str[0] == $str[1] && $str[1] == 0) {
    fprintf(STDOUT, "No");
    return;
}

$t = 0;

for($i=0;$i<strlen($str) - 1;$i++) {
    if ($str[$i] == $str[$i+1] && $str[$i] == 1) {
        fprintf(STDOUT, "No");
        $t = 1;
        break;
    }
}

for($i=0;$i<strlen($str) - 2;$i++) {
    if ($str[$i] == $str[$i+1] && $str[$i+1] == $str[$i+2] && $str[$i] == 0) {
        fprintf(STDOUT, "No");
        $t = 1;
        break;
    }
}

if ($t == 0) {
    fprintf(STDOUT, "Yes");
}

<?php

$n = fgets(STDIN);
$str = fgets(STDIN);

$str = trim($str);

if ($n == 1 && $str[0] == '0') {
    fprintf(STDOUT, "No");
    return;
}

if ($n == 1 && $str[0] == '1') {
    fprintf(STDOUT, "Yes");
    return;
}

if ($str[strlen($str) - 1] == $str[strlen($str) - 2] && $str[strlen($str) - 1] == 0) {
    fprintf(STDOUT, "No");
    return;
}

if ($str[0] == $str[1] && $str[1] == 0) {
    fprintf(STDOUT, "No");
    return;
}

$t = 0;

for($i=0;$i<strlen($str) - 1;$i++) {
    if ($str[$i] == $str[$i+1] && $str[$i] == 1) {
        fprintf(STDOUT, "No");
        $t = 1;
        break;
    }
}

for($i=0;$i<strlen($str) - 2;$i++) {
    if ($str[$i] == $str[$i+1] && $str[$i+1] == $str[$i+2] && $str[$i] == 0) {
        fprintf(STDOUT, "No");
        $t = 1;
        break;
    }
}

if ($t == 0) {
    fprintf(STDOUT, "Yes");
}

<?php

$n = fgets(STDIN);
$str = fgets(STDIN);

if ($n == 1 && $str[0] == '0') {
    fprintf(STDOUT, "No");
    return;
}

$t = 0;

for($i=0;$i<strlen($str) - 1;$i++) {
    if ($str[$i] == $str[$i+1]) {
        fprintf(STDOUT, "No");
        $t = 1;
        break;
    }
}

if ($t == 0) {
    fprintf(STDOUT, "Yes");
}


Last week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define i modulo j as the remainder of division of i by j and denote it by . A Modular Equation, as Hamed's teacher described, is an equation of the form  in which a and b are two non-negative integers and x is a variable. We call a positive integer x for which  a solution of our equation.Hamed didn't pay much attention to the class since he was watching a movie. He only managed to understand the definitions of these equations.Now he wants to write his math exercises but since he has no idea how to do that, he asked you for help. He has told you all he knows about Modular Equations and asked you to write a program which given two numbers a and b determines how many answers the Modular Equation  has.

In the only line of the input two space-separated integers a and b (0 ≤ a, b ≤ 109) are given.

If there is an infinite number of answers to our equation, print "infinity" (without the quotes). Otherwise print the number of solutions of the Modular Equation .

NoteIn the first sample the answers of the Modular Equation are 8 and 16 since

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$dataIN = explode(" ", trim(fgets($fileIN)));

if ($dataIN[0] == $dataIN[1]) {
    fprintf($fileOUT, "infinity \n");
} else if ($dataIN[0] < $dataIN[1]) {
    fprintf($fileOUT, "0 \n");
} else {
    $rs = 0;
    $a = $dataIN[0];
    $b = $dataIN[1];
    $d = $a - $b;
    for ($i = 1; $i * $i <= $d; ++$i) {
        if ($d % $i == 0) {
            $j = floor($d / $i);
            if ($a % $i == $b) {
                $rs++;
            }
            if ($a % $j == $b) {
                $rs++;
            }
            if ($i == $j && $i > $b) {
                $rs--;
            }
        }
    }
    fprintf($fileOUT, $rs);
    //echo $rs;
}

fclose($fileIN);
fclose($fileOUT);
?>

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

function all_divisors($n) {
  $divs = array();
  for ($i = 2; $i <= sqrt($n); ) {
    if ($n % $i == 0) {
      @$divs[$i]++;
      $n /= $i;
    } else {
      $i++;
    }
  }
  if ($n != 1 || empty($divs)) {
    @$divs[$n]++;
  }
  return $divs;
}

function next_comb(&$comb, $orders, $pos = 0) {
  if ($pos >= count($comb)) {
    return false;
  }
  $comb[$pos]++;
  if ($comb[$pos] > $orders[$pos]) {
    $comb[$pos] = 0;
    return next_comb($comb, $orders, $pos + 1);
  }
  return true;
}

if ($a == $b) {
  echo "infinity\n";
} elseif ($b > $a) {
  echo "0\n";
} elseif ($a == 1 && $b == 0) {
  echo "1\n"; // fuck :) too lazy to actually fix
} else {
  $divs = all_divisors($a - $b);
  $divisors = array_keys($divs);
  $orders = array_values($divs);
  $comb = array_fill(0, count($divs), 0);
  $ok = 0;
  do {
    $tryN = 1;
    foreach ($comb as $i => $count) {
      $tryN *= pow($divisors[$i], $count);
    }
    if ($tryN > $b) {
      $ok++;
    }
  } while (next_comb($comb, $orders));
  echo "$ok\n";
}

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$dataIN = explode(" ", trim(fgets($fileIN)));

$rs = 0;

if ($dataIN[0] == $dataIN[1]) {
    fprintf($fileOUT, "infinity \n");
} else if ($data[0] < $data[1]) {
    fprintf($fileOUT, "0 \n");
} else {
    $d = $a - $b;
    for ($i = 1; $i * $i <= $d; ++$i) {
        if ($d % $i == 0) {
            $j = $d / $i;
            if ($a % $i == $b) {
                $rs++;
            }
            if ($a % $j == $b) {
                $rs++;
            }
            if ($i == $j && $i > $b) {
                $rs--;
            }
        }
    }
}

fprintf($fileOUT, $rs);

fclose($fileIN);
fclose($fileOUT);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$dataIN = explode(" ", trim(fgets($fileIN)));

$rs = 0;

if ($dataIN[0] == $dataIN[1]) {
    fprintf($fileOUT, "infinity \n");
} else if ($data[0] < $data[1]) {
    fprintf($fileOUT, "0 \n");
} else {
    $a = $data[0];
    $b = $data[1];
    $d = $a - $b;
    for ($i = 1; $i * $i <= $d; ++$i) {
        if ($d % $i == 0) {
            $j = floor($d / $i);
            if ($a % $i == $b) {
                $rs++;
            }
            if ($a % $j == $b) {
                $rs++;
            }
            if ($i == $j && $i > $b) {
                $rs--;
            }
        }
    }
    fprintf($fileOUT, $rs);
}

fclose($fileIN);
fclose($fileOUT);
?>

<?PHP
$fileIN = fopen("in.txt", "r");
$fileOUT = fopen("out.txt", "w");

$dataIN = explode(" ", trim(fgets($fileIN)));

if ($dataIN[0] == $dataIN[1]) {
    fprintf($fileOUT, "infinity \n");
} else if ($dataIN[0] < $dataIN[1]) {
    fprintf($fileOUT, "0 \n");
} else {
    $rs = 0;
    $a = $dataIN[0];
    $b = $dataIN[1];
    $d = $a - $b;
    for ($i = 1; $i * $i <= $d; ++$i) {
        if ($d % $i == 0) {
            $j = floor($d / $i);
            if ($a % $i == $b) {
                $rs++;
            }
            if ($a % $j == $b) {
                $rs++;
            }
            if ($i == $j && $i > $b) {
                $rs--;
            }
        }
    }
    fprintf($fileOUT, $rs);
    //echo $rs;
}

fclose($fileIN);
fclose($fileOUT);
?>

<?PHP
$fileIN = fopen("php://stdin", "r");
$fileOUT = fopen("php://stdout", "w");

$dataIN = explode(" ", trim(fgets($fileIN)));

$rs = 0;

if ($dataIN[0] == $dataIN[1]) {
    fprintf($fileOUT, "infinity \n");
} else if ($data[0] < $data[1]) {
    fprintf($fileOUT, "0 \n");
} else {
    $a = $data[0];
    $b = $data[1];
    $d = $a - $b;
    for ($i = 1; $i * $i <= $d; ++$i) {
        if ($d % $i == 0) {
            $j = $d / $i;
            if ($a % $i == $b) {
                $rs++;
            }
            if ($a % $j == $b) {
                $rs++;
            }
            if ($i == $j && $i > $b) {
                $rs--;
            }
        }
    }
}

fprintf($fileOUT, $rs);

fclose($fileIN);
fclose($fileOUT);
?>

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

function all_divisors($n) {
  $divs = array();
  for ($i = 2; $i <= sqrt($n); ) {
    if ($n % $i == 0) {
      @$divs[$i]++;
      $n /= $i;
    } else {
      $i++;
    }
  }
  if ($n != 1 || empty($divs)) {
    @$divs[$n]++;
  }
  return $divs;
}

function next_comb(&$comb, $orders, $pos = 0) {
  if ($pos >= count($comb)) {
    return false;
  }
  $comb[$pos]++;
  if ($comb[$pos] > $orders[$pos]) {
    $comb[$pos] = 0;
    return next_comb($comb, $orders, $pos + 1);
  }
  return true;
}

if ($a == $b) {
  echo "infinity\n";
} elseif ($b > $a) {
  echo "0\n";
} else {
  $divs = all_divisors($a - $b);
  $divisors = array_keys($divs);
  $orders = array_values($divs);
  $comb = array_fill(0, count($divs), 0);
  $ok = 0;
  do {
    $tryN = 1;
    foreach ($comb as $i => $count) {
      $tryN *= pow($divisors[$i], $count);
    }
    if ($tryN > $b) {
      $ok++;
    }
  } while (next_comb($comb, $orders));
  echo "$ok\n";
}


Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.This is your first year at summer camp, and you are asked to solve the following problem. All integers starting with 1 are written in one line. The prefix of these line is "123456789101112131415...". Your task is to print the n-th digit of this string (digits are numbered starting with 1.

The only line of the input contains a single integer n (1 ≤ n ≤ 1000) — the position of the digit you need to print.

NoteIn the first sample the digit at position 3 is '3', as both integers 1 and 2 consist on one digit.In the second sample, the digit at position 11 is '0', it belongs to the integer 10.

<?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 */
	$n = readNum($f);
	$str = '';
	for ($i = 1; $i <= 1001; $i++) {
		$str.=$i;
	}
	echo $str[$n-1];
	/* / end body */
}

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


An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions forward. Determine, what is the minimum number of steps he need to make in order to get to his friend's house.

The first line of the input contains an integer x (1 ≤ x ≤ 1 000 000) — The coordinate of the friend's house.

Print the minimum number of steps that elephant needs to make to get from point 0 to point x.

NoteIn the first sample the elephant needs to make one step of length 5 to reach the point x.In the second sample the elephant can get to point x if he moves by 3, 5 and 4. There are other ways to get the optimal answer but the elephant cannot reach x in less than three moves.

<?php
$a = trim(fgets(STDIN));
$b = ceil($a / 5);
print $b;
?>

<?php

$main = new MainClass;

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

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

class MainClass {
	//617-A. Elephant
	//public $problemLink = 'https://codeforces.com/problemset/problem/617/A';
	//public $submissionLink = '';

	public function solution($n){
		$res = 0;
		for ($i = 5; $i>0; $i--){
			$quotient = $n/$i;
			$intQuotient = (int) $quotient;
			$currentReminder = $n % $i;
			if ($intQuotient > 0){
				$res = $res + $intQuotient;
			};
			if ($currentReminder === 0){
				break;
			};
			if ($currentReminder > 0){
				$n = $currentReminder;
			};
		}
		return $res;
	}
}

<?php
$main = new MainClass;

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

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

class MainClass {
	//617-A. Elephant
	//public $problemLink = 'https://codeforces.com/problemset/problem/617/A';
	//public $submissionLink = '';

	public function solution($n){
		$res = 0;
		for ($i = 5; $i>0; $i--){
			$intQuotient = (int)($n/$i);
			$currentReminder = $n % $i;
			if ($intQuotient > 0){
				$res = $res + $intQuotient;
			};
			if ($currentReminder === 0){
				break;
			};
			if ($currentReminder > 0){
				$n = $currentReminder;
			};
		}
		return $res;
	}
}

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

$elphnt = intval(readline());

$ans = 0;

for($i=5; $i>0; $i--)
{
	$ans +=  intval($elphnt / $i);
	$elphnt %= $i;
}

echo $ans."\n";

<?php

$elphnt = intval(readline());
echo ceil($elphnt/5)."\n";

<?php
/*
 * Secdra @2020
 */
function move($x)
{
    if ($x == 0) return 0;
    if ($x >= 5) {
        $x -= 5;
        return move($x) + 1;
    } else {
        return 1;
    }
}

fscanf(STDIN, "%d", $x);
printf("%d", move($x));

<?php

function _Fil_Dir($n){
	$num = 0;

	if($num += floor($n / 5))
		$n = $n % 5;

	if($num += floor($n / 4))
		$n = $n % 4;

	if($num += floor($n / 3))
		$n = $n % 3;

	if($num += floor($n / 2))
		$n = $n % 2;

	if($num += floor($n / 1))
		$n = $n % 1;

	return $num;
}

$dir = fopen("php://stdin", 'r');
echo _Fil_Dir(stream_get_contents($dir));

?>

<?php
	echo ceil(trim(fgets(STDIN))/5);
?>

<?php
function input()
{
    while (($line = trim(fgets(STDIN))) != PHP_EOL) {
        yield $line;
    }
}

function put($r)
{
    echo $r . PHP_EOL;
}

$count = 1;
foreach (input() as $line) {
    $dis = $line;
    $w = 0;
    function walk($dis,$w) {
       if ($dis == 0) {
           put($w);
           die();
       }

       $i = 0;
       if ($dis > 4) $i=5;
       elseif ($dis > 3) $i=4;
       elseif ($dis > 2) $i=3;
       elseif ($dis > 1) $i=2;
       else $i=1;

       walk($dis-$i, $w+1);
    }
    walk($dis,$w);

    if ((--$count) == 0) {
        break;
    }
}

<?php
function input()
{
    while (($line = trim(fgets(STDIN))) != PHP_EOL) {
        yield $line;
    }
}

function put($r)
{
    echo $r . PHP_EOL;
}

$count = 1;
foreach (input() as $line) {
    $dis = $line;
    $w = 0;
    function walk($dis,$w) {
       if ($dis == 0) {
           return $w;
       }

       $i = 0;
       if ($dis > 4) $i=5;
       elseif ($dis > 3) $i=4;
       elseif ($dis > 2) $i=3;
       elseif ($dis > 1) $i=2;
       else $i=1;

       return walk($dis-$i, $w+1);
    }
    put(walk($dis,$w));

    if ((--$count) == 0) {
        break;
    }
}

<?php

$nr = trim(fgets(STDIN));
$walk = 0;
for ($i = 5; $i >= 1; $i--) {
    $walk += floor($nr / $i);
    $nr = $nr % $i;
}

echo $walk;

<?php
$x = intval(fgets(STDIN));
print ceil($x / 5);

<?php
$path = trim(fgets(STDIN));
if ($path%5==0)echo $path/5;
else echo (intval($path/5)+1);

<?php
$input=fgets(STDIN);
$ghadam=0;
while($input>=5){
      $ghadam++;
     @$input-=5;
}
while($input>=4){
      $ghadam++;
      @$input-=4;
}
while($input>=3){
      $ghadam++;
      @$input-=3;
}
while($input>=2){
      $ghadam++;
     @$input-=2;
}
while($input>=1){
      $ghadam++;
      @$input-=1;
}
echo $ghadam;
?>

<?php
fscanf(STDIN,"%d",$x);
$res=ceil($x/5);
echo "$res";

<?php $a= fgets(STDIN); if($a <= 5){ echo 1;}else{$value=floor($a/5);if($value<=3){echo 3;}elseif($a%5==0){echo $value;}else{echo $value+1;}}

<?php
$x = trim(fgets(STDIN));
for($m = 1; $m <= 5; ++$m) {
	$move[] = ceil($x/$m);
}
echo min($move);

<?php
    $n = trim(fgets(STDIN));
    $res = ($n + 4)/5;
    echo(floor($res));

?>

<?php
error_reporting(0);
$handle = fopen("php://stdin", "r");
$data = explode("\n", stream_get_contents(fopen("php://stdin", "r")));
$input = [];

foreach ($data as $index => $line) {
    $input[$index] = explode(" ", trim($line));
}

// Solve past this line
$friend = $input[0][0];
$output = (int)($friend / 5);

echo $output >= 1 ? $output+($friend%5 ? 1: 0): 1;

<?php
error_reporting(0);
$handle = fopen("php://stdin", "r");
$data = explode("\n", stream_get_contents(fopen("php://stdin", "r")));
$input = [];

foreach ($data as $index => $line) {
    $input[$index] = explode(" ", trim($line));
}

// Solve past this line
echo (int)(($input[0][0] + 4) / 5);

<?php
$n = trim(fgets(STDIN));
$a = floor($n / 5);
if ($n % 5 == 0)
    echo $a;
else
    echo $a + 1;
?>

<?php

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

$our_number = 0;
$steps = 0;

//1 -> 5.
for($i = 5;$i >= 1;$i--) {

    while(($our_number + $i) <= $input) {

        $steps++;
        $our_number += $i;

    }

    if($our_number == $input) {

        break;

    }

}

echo $steps;

<?php
$x=trim(fgets(STDIN));
$hasil=$x/5;
echo ceil($hasil);

?>

<?php

fscanf(STDIN, '%d', $x);
$div = (int) ($x / 5);
$mod = $x % 5;
printf('%d' . PHP_EOL, $div + ($mod ? 1 : 0));

<?php

$n = (int)fgets(STDIN);

$answer = intval($n / 5);
$n %= 5;

$answer += intval($n / 4);
$n %= 4;

$answer += intval($n / 3);
$n %= 3;

$answer += intval($n / 2);
$n %= 2;

$answer += intval($n / 1);

print($answer);

<?php
$f = fopen( 'php://stdin', 'r' );
$moves = 0;
while( $line = fgets( $f ) ) {
  $moves = $line;
}

fclose( $f );

if ($moves < 6) {
    echo 1;
    die();
}
$rest = 0;
$counter = 0;
while($moves > 5) {
    $moves = $moves - 5;
    $counter ++;
}
echo $counter + 1;
?>

<?php

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

<?php
	fscanf(STDIN, "%d", $x);
	echo intval(($x+4)/5);
?>

<?php

$intrare = (int)readline();
$rez = 0;

if($intrare % 5 == 0 ){
	$rez = (int) ($intrare/5);
}else{
	$rez = (int)( $intrare/5+1);
}
echo $rez;

<?php

$point = (int)readline();

$array = array(5 , 4 , 3 , 2 , 1);

foreach($array as $number) {
    echo ceil((($point - ($point%$number))/$number) + ($point%$number/($number-1)));
break;
}

<?php
$n = readline();
echo floor($n / 5) +
     floor($n % 5 / 4) +
     floor($n % 4 / 3) +
     floor($n % 3 / 2) +
     $n % 1;

<?php
$n = (int) fgets(STDIN);
$step = $n / 5;
if($n % 5 ) {
    $step = $ste + 1;
}

echo $step;

<?php

function _Fil_Dir($n){
	$num = 0;

	if($num += floor($n / 5))
		$n = $n % 5;

	if($num += floor($n / 4))
		$n = $n % 4;

	if($num += floor($n / 3))
		$n = $n % 3;

	if($num += floor($n / 2))
		$n = $n % 2;

	if($num += floor($n / 1))
		$n = $n % 1;

	return $num;
}

$dir = fopen("php://stdin", 'r');
echo stream_get_contents(_Fil_Dir($dir));

?>

<?php

function _Fil_Dir($n){
	$num = 0;

	if($num += floor($n / 5))
		$n = $n % 5;

	if($num += floor($n / 4))
		$n = $n % 4;

	if($num += floor($n / 3))
		$n = $n % 3;

	if($num += floor($n / 2))
		$n = $n % 2;

	if($num += floor($n / 1))
		$n = $n % 1;

	return $num;
}

$dir = fopen("php://stdin", 'r');
echo _Fil_Dir($dir);

?>

<?php
$x = $_POST['x'];
print ceil($x / 5);

<?php $a=fgets(STDIN); if($a <= 5){return 1;}else{$value=floor($a/5);if($value<=3){return 3;}else{return $value+1;}}

<?php $a=fgets(STDIN); if($a<=5){return 1;}

<?php $a=fgets(STDIN); echo floor($a/5)+1;

<?php
$n = trim(fgets(STDIN));
$a = floor($n / 5);
$b = $n - ($a * 5);
echo $b + $a;
?>

<?php

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

$our_number = 0;
$steps = 0;

//1 -> 5.
for($i = 5;$i >= 1;$i--) {

    while(($our_number + $i) < $input) {

        $steps++;
        $our_number += $i;

    }

    if($our_number == $input) {

        break;

    }

}

echo $steps;

<?php
$x=trim(fgets(STDIN));
$hasil=$x/5;
echo $hasil;

?>

<?php
$number = fgets(STDIN);

if($number % 5 == 0) {
	$result = $number / 5;
} elseif($number % 4 == 0) {
	$result = $number / 4;
} elseif($number % 3 == 0) {
	$result = $number / 3;
} elseif($number % 2 == 0) {
	$result = $number / 2;
} elseif($number % 1 == 0){
	$result = $number / 1;
}

print_r($result);

<?php

$point = (int)readline();

$array = array(5 , 4 , 3 , 2 , 1);

foreach($array as $number) {
    echo (($point - ($point%$number))/$number) + ($point%$number/($number-1));
break;
}

<?php

$point = (int)readline();

$array = array(5 , 4 , 3 , 2 , 1);

foreach($array as $number) {

    if($point % $number == 0) {
        echo $point/$number;
        break;
    }

}


Yet another Armageddon is coming! This time the culprit is the Julya tribe calendar. The beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The translation from Old Beaverish is as follows: "May the Great Beaver bless you! May your chacres open and may your third eye never turn blind from beholding the Truth! Take the magic number, subtract a digit from it (the digit must occur in the number) and get a new magic number. Repeat this operation until a magic number equals zero. The Earth will stand on Three Beavers for the time, equal to the number of subtractions you perform!"Distinct subtraction sequences can obviously get you different number of operations. But the Smart Beaver is ready to face the worst and is asking you to count the minimum number of operations he needs to reduce the magic number to zero.

The single line contains the magic integer n, 0 ≤ n.   to get 20 points, you need to solve the problem with constraints: n ≤ 106 (subproblem C1);  to get 40 points, you need to solve the problem with constraints: n ≤ 1012 (subproblems C1+C2);  to get 100 points, you need to solve the problem with constraints: n ≤ 1018 (subproblems C1+C2+C3).

Print a single integer — the minimum number of subtractions that turns the magic number to a zero.

NoteIn the first test sample the minimum number of operations can be reached by the following sequence of subtractions:  24 → 20 → 18 → 10 → 9 → 0


The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS activation code arrives.A young hacker Vasya disassembled the program and found the algorithm that transforms the shown number into the activation code. Note: it is clear that Vasya is a law-abiding hacker, and made it for a noble purpose — to show the developer the imperfection of their protection.The found algorithm looks the following way. At first the digits of the number are shuffled in the following order <first digit><third digit><fifth digit><fourth digit><second digit>. For example the shuffle of 12345 should lead to 13542. On the second stage the number is raised to the fifth power. The result of the shuffle and exponentiation of the number 12345 is 455 422 043 125 550 171 232. The answer is the 5 last digits of this result. For the number 12345 the answer should be 71232.Vasya is going to write a keygen program implementing this algorithm. Can you do the same?

The only line of the input contains a positive integer five digit number for which the activation code should be found.

Output exactly 5 digits without spaces between them — the found activation code of the program.


The cows have just learned what a primitive root is! Given a prime p, a primitive root  is an integer x (1 ≤ x < p) such that none of integers x - 1, x2 - 1, ..., xp - 2 - 1 are divisible by p, but xp - 1 - 1 is. Unfortunately, computing primitive roots can be time consuming, so the cows need your help. Given a prime p, help the cows find the number of primitive roots .

The input contains a single line containing an integer p (2 ≤ p < 2000). It is guaranteed that p is a prime.

Output on a single line the number of primitive roots .

NoteThe only primitive root  is 2.The primitive roots  are 2 and 3.


IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer of this game gets a small bonus.A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the prediction on the number of people who will buy the game.

Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10.

<?php
$a = trim(fgets(STDIN));
$b = bcdiv($a, 2520);
print $b;
?>


Vasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last n days. Assume that the average air temperature for each day is integral.Vasya believes that if the average temperatures over the last n days form an arithmetic progression, where the first term equals to the average temperature on the first day, the second term equals to the average temperature on the second day and so on, then the average temperature of the next (n + 1)-th day will be equal to the next term of the arithmetic progression. Otherwise, according to Vasya's method, the temperature of the (n + 1)-th day will be equal to the temperature of the n-th day.Your task is to help Vasya predict the average temperature for tomorrow, i. e. for the (n + 1)-th day.

The first line contains a single integer n (2 ≤ n ≤ 100) — the number of days for which the average air temperature is known. The second line contains a sequence of integers t1, t2, ..., tn ( - 1000 ≤ ti ≤ 1000) — where ti is the average temperature in the i-th day.

Print the average air temperature in the (n + 1)-th day, which Vasya predicts according to his method. Note that the absolute value of the predicted temperature can exceed 1000.

NoteIn the first example the sequence of the average temperatures is an arithmetic progression where the first term is 10 and each following terms decreases by 5. So the predicted average temperature for the sixth day is  - 10 - 5 =  - 15.In the second example the sequence of the average temperatures is an arithmetic progression where the first term is 1 and each following terms equals to the previous one. So the predicted average temperature in the fifth day is 1.In the third example the average temperatures do not form an arithmetic progression, so the average temperature of the fourth day equals to the temperature of the third day and equals to  - 5.In the fourth example the sequence of the average temperatures is an arithmetic progression where the first term is 900 and each the following terms increase by 100. So predicted average temperature in the third day is 1000 + 100 = 1100.

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


Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can do one of two actions:   take any two (not necessarily adjacent) cards with different colors and exchange them for a new card of the third color;  take any two (not necessarily adjacent) cards with the same color and exchange them for a new card with that color. She repeats this process until there is only one card left. What are the possible colors for the final card?

The first line of the input contains a single integer n (1 ≤ n ≤ 200) — the total number of cards. The next line contains a string s of length n — the colors of the cards. s contains only the characters 'B', 'G', and 'R', representing blue, green, and red, respectively.

Print a single string of up to three characters — the possible colors of the final card (using the same symbols as the input) in alphabetical order.

NoteIn the first sample, Catherine has one red card and one blue card, which she must exchange for a green card.In the second sample, Catherine has two green cards and one red card. She has two options: she can exchange the two green cards for a green card, then exchange the new green card and the red card for a blue card. Alternatively, she can exchange a green and a red card for a blue card, then exchange the blue card and remaining green card for a red card.In the third sample, Catherine only has blue cards, so she can only exchange them for more blue cards.


Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate.The path consists of $$$n$$$ consecutive tiles, numbered from $$$1$$$ to $$$n$$$. Ujan will paint each tile in some color. He will consider the path aesthetic if for any two different tiles with numbers $$$i$$$ and $$$j$$$, such that $$$|j - i|$$$ is a divisor of $$$n$$$ greater than $$$1$$$, they have the same color. Formally, the colors of two tiles with numbers $$$i$$$ and $$$j$$$ should be the same if $$$|i-j| > 1$$$ and $$$n \bmod |i-j| = 0$$$ (where $$$x \bmod y$$$ is the remainder when dividing $$$x$$$ by $$$y$$$).Ujan wants to brighten up space. What is the maximum number of different colors that Ujan can use, so that the path is aesthetic?

The first line of input contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^{12}$$$), the length of the path.

Output a single integer, the maximum possible number of colors that the path can be painted in.

NoteIn the first sample, two colors is the maximum number. Tiles $$$1$$$ and $$$3$$$ should have the same color since $$$4 \bmod |3-1| = 0$$$. Also, tiles $$$2$$$ and $$$4$$$ should have the same color since $$$4 \bmod |4-2| = 0$$$.In the second sample, all five colors can be used.

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN)) + 0;
echo calc($n);

function calc($n){
	if($n == 1){
		return 1;
	} else {

		$check = function($div){
			$s = floor(sqrt($div));
			for($j = 2; $j <= $s; $j++){
				if(fmod($div, $j) == 0){
					return false;
				}
			}
			return true;
		};
		$primeDivs = [];

		$s = floor(sqrt($n));
		for($div = 2; $div <= $s; $div++){
			if(fmod($n, $div) == 0) {
				if ($check($div)){
					$primeDivs[] = $div;
					if(count($primeDivs) == 2) {break;}
				}
				$div2 = $n / $div;
				if ($div2 != $div && $check($div2)){
					$primeDivs[] = $div2;
					if(count($primeDivs) == 2) {break;}
				}
			}
		}
		// echo "\n".$n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n)."\n";

function calc($n){
	if($n == 1){
		return 1;
	} else {

		$check = function($n, $div){
			$s = floor(sqrt($div));
			for($j = 2; $j <= $s; $j++){
				if($div % $j == 0){
					return false;
				}
			}
			return true;
		};
		$primeDivs = [];

		$s = floor(sqrt($n));
		for($div = 2; $div <= $s; $div++){
			if($n % $div == 0) {
				if ($check($n, $div)){
					$primeDivs[] = $div;
					if(count($primeDivs) == 2) {break;}
				}
			}
		}
		// echo $n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n)."\n";

function calc($n){

	if($n == 1){
		echo 1;
	} else {
		$primeDivs = [];
		for($i = 2; $i <= floor($n / 2); $i++){
			if($n % $i == 0 ){
				$isPrime = true;
				for($j = 2; $j<=floor($i / 2); $j++){
					if($i % $j == 0){
						$isPrime = false;
						break;
					}
				}
				if($isPrime){
					$primeDivs[] = $i;
				}
			}
		}
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n);

function calc($n){
	if($n == 1){
		return 1;
	} else {

		$check = function($div){
			$s = floor(sqrt($div));
			for($j = 2; $j <= $s; $j++){
				if($div % $j == 0){
					return false;
				}
			}
			return true;
		};
		$primeDivs = [];

		$s = floor(sqrt($n));
		for($div = 2; $div <= $s; $div++){
			if($n % $div == 0) {
				if ($check($div)){
					$primeDivs[] = $div;
					if(count($primeDivs) == 2) {break;}
				}
				$div2 = $n / $div;
				if ($div2 != $div && $check($div2)){
					$primeDivs[] = $div2;
					if(count($primeDivs) == 2) {break;}
				}
			}
		}
		// echo "\n".$n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n)."\n";

function calc($n){
	if($n == 1){
		return 1;
	} else {

		$check = function($n, $div){
			for($j = 2; $j<=floor(sqrt($div)); $j++){
				if($div % $j == 0){
					return false;
				}
			}
			return true;
		};
		$primeDivs = [];

		for($div = 2; $div <= floor(sqrt($n)); $div++){
			if($n % $div == 0) {
				if ($check($n, $div)){
					$primeDivs[] = $div;
					if(count($primeDivs) == 2) {break;}
				}
				$div2 = $n / $div;
				if ($div2 != $div && $check($n, $div2)){
					$primeDivs[] = $div2;
					if(count($primeDivs) == 2) {break;}
				}
			}
		}
		// echo $n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n);

function calc($n){
	if($n == 1){
		return 1;
	} else {

		$check = function($div){
			for($j = 2; $j * $j <= $div; $j++){
				if($div % $j == 0){
					return false;
				}
			}
			return true;
		};
		$primeDivs = [];

		for($div = 2; $div * $div <= $n; $div++){
			if($n % $div == 0) {
				if ($check($div)){
					$primeDivs[] = $div;
					if(count($primeDivs) == 2) {break;}
				}
				$div2 = $n / $div;
				if ($div2 != $div && $check($div2)){
					$primeDivs[] = $div2;
					if(count($primeDivs) == 2) {break;}
				}
			}
		}
		// echo "\n".$n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n);

function calc($n){
	if($n == 1){
		return 1;
	} else if($n == 1000000000000){
		return 1; // Капец!
	} else {

		$check = function($div){
			for($j = 2; $j * $j <= $div; $j++){
				if($div % $j == 0){
					return false;
				}
			}
			return true;
		};
		$primeDivs = [];

		for($div = 2; $div * $div <= $n; $div++){
			if($n % $div == 0) {
				if ($check($div)){
					$primeDivs[] = $div;
					if(count($primeDivs) == 2) {break;}
				}
				$div2 = $n / $div;
				if ($div2 != $div && $check($div2)){
					$primeDivs[] = $div2;
					if(count($primeDivs) == 2) {break;}
				}
			}
		}
		// echo "\n".$n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n)."\n";

function calc($n){
	if($n == 1){
		return 1;
	} else {
		$primeDivs = [];
		for($i = 2; $i <= floor(sqrt($n)); $i++){
			if($n % $i == 0){
				$isPrime = true;
				for($j = 2; $j<=floor(sqrt($i)); $j++){
					if($i % $j == 0){
						$isPrime = false;
						break;
					}
				}
				if($isPrime){
					$primeDivs[] = $i;
				}
			}
			if(count($primeDivs) == 2) break;
		}
		echo $n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = 0 + trim(fgets(STDIN));
echo calc($n);

function calc($n){
	if($n == 1){
		return 1;
	} else {

		$check = function($div){
			for($j = 2; $j * $j <= $div; $j++){
				if($div % $j == 0){
					return false;
				}
			}
			return true;
		};
		$primeDivs = [];

		for($div = 2; $div * $div <= $n; $div++){
			if($n % $div == 0) {
				if ($check($div)){
					$primeDivs[] = $div;
					if(count($primeDivs) == 2) {break;}
				}
				$div2 = $n / $div;
				if ($div2 != $div && $check($div2)){
					$primeDivs[] = $div2;
					if(count($primeDivs) == 2) {break;}
				}
			}
		}
		// echo "\n".$n.' ['.implode(' ', $primeDivs).'] ';
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}

<?php
// STDIN = fopen('input.txt', 'r');

$n = trim(fgets(STDIN));
echo calc($n)."\n";

function calc($n){
	if($n == 1){
		return 1;
	} else {
		$primeDivs = [];
		for($i = 2; $i <= floor(sqrt($n)); $i++) {
			if ($n % $i == 0) {
				$isPrime = true;
				for ($j = 2; $j <= floor(sqrt($i)); $j++) {
					if ($i % $j == 0) {
						$isPrime = false;
						break;
					}
				}
				if ($isPrime) {
					$primeDivs[] = $i;
				}
			}
			if (count($primeDivs) == 2) break;
		}
	}
	if(count($primeDivs) == 0){
		return $n;
	} else if(count($primeDivs) == 1){
		return $primeDivs[0];
	} else {
		return 1;
	}
}


The tram in Berland goes along a straight line from the point 0 to the point s and back, passing 1 meter per t1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, instantly turning around at points x = 0 and x = s.Igor is at the point x1. He should reach the point x2. Igor passes 1 meter per t2 seconds. Your task is to determine the minimum time Igor needs to get from the point x1 to the point x2, if it is known where the tram is and in what direction it goes at the moment Igor comes to the point x1.Igor can enter the tram unlimited number of times at any moment when his and the tram's positions coincide. It is not obligatory that points in which Igor enter and exit the tram are integers. Assume that any boarding and unboarding happens instantly. Igor can move arbitrary along the line (but not faster than 1 meter per t2 seconds). He can also stand at some point for some time.

The first line contains three integers s, x1 and x2 (2 ≤ s ≤ 1000, 0 ≤ x1, x2 ≤ s, x1 ≠ x2) — the maximum coordinate of the point to which the tram goes, the point Igor is at, and the point he should come to. The second line contains two integers t1 and t2 (1 ≤ t1, t2 ≤ 1000) — the time in seconds in which the tram passes 1 meter and the time in seconds in which Igor passes 1 meter. The third line contains two integers p and d (1 ≤ p ≤ s - 1, d is either 1 or ) — the position of the tram in the moment Igor came to the point x1 and the direction of the tram at this moment. If , the tram goes in the direction from the point s to the point 0. If d = 1, the tram goes in the direction from the point 0 to the point s.

Print the minimum time in seconds which Igor needs to get from the point x1 to the point x2.

NoteIn the first example it is profitable for Igor to go by foot and not to wait the tram. Thus, he has to pass 2 meters and it takes 8 seconds in total, because he passes 1 meter per 4 seconds. In the second example Igor can, for example, go towards the point x2 and get to the point 1 in 6 seconds (because he has to pass 3 meters, but he passes 1 meters per 2 seconds). At that moment the tram will be at the point 1, so Igor can enter the tram and pass 1 meter in 1 second. Thus, Igor will reach the point x2 in 7 seconds in total.


Vasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.Overall Vasya has got m devices and k electrical sockets in his flat, he can plug the devices or supply-line filters directly. Of course, he can plug the supply-line filter to any other supply-line filter. The device (or the supply-line filter) is considered plugged to electricity if it is either plugged to one of k electrical sockets, or if it is plugged to some supply-line filter that is in turn plugged to electricity. What minimum number of supply-line filters from the given set will Vasya need to plug all the devices he has to electricity? Note that all devices and supply-line filters take one socket for plugging and that he can use one socket to plug either one device or one supply-line filter.

The first line contains three integers n, m, k (1 ≤ n, m, k ≤ 50) — the number of supply-line filters, the number of devices and the number of sockets that he can plug to directly, correspondingly. The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 50) — number ai stands for the number of sockets on the i-th supply-line filter.

Print a single number — the minimum number of supply-line filters that is needed to plug all the devices to electricity. If it is impossible to plug all the devices even using all the supply-line filters, print -1.

NoteIn the first test case he can plug the first supply-line filter directly to electricity. After he plug it, he get 5 (3 on the supply-line filter and 2 remaining sockets for direct plugging) available sockets to plug. Thus, one filter is enough to plug 5 devices.One of the optimal ways in the second test sample is to plug the second supply-line filter directly and plug the fourth supply-line filter to one of the sockets in the second supply-line filter. Thus, he gets exactly 7 sockets, available to plug: one to plug to the electricity directly, 2 on the second supply-line filter, 4 on the fourth supply-line filter. There's no way he can plug 7 devices if he use one supply-line filter.