<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$cards = explode(" ",$s);
$cities_cnt=$cards[0];
$limak_city=$cards[1]-1;
$s =  trim(fgets($stdin));
$crims = explode(" ",$s);
$catched=0;
if($limak_city>($cities_cnt/2)){
for ($i=0;$i<($limak_city);$i++){

	$r = abs($limak_city-$i);
	//echo $r;
	if(($cities_cnt-($limak_city+$r)<=0)||(($limak_city-$r)<0)){
	   // echo "!".$crims[$limak_city-$r]."!\n";
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}else{
	   // echo "+".($limak_city+$r);
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
	//echo $catched." ";
}
}else{
	for ($i=$cities_cnt;$i>($limak_city);$i--){

	$r = abs($limak_city-$i);
//	echo $r;
	if(($cities_cnt-($limak_city+$r)<=0)||(($limak_city-$r)<0)){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;

		}
	}else{
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
//	echo $catched." ";
}

}
if($crims[$limak_city]>0){
	$catched+=1;
}
echo $catched;

<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$cards = explode(" ",$s);
$cities_cnt=$cards[0];
$limak_city=$cards[1]-1;
$s =  trim(fgets($stdin));
$crims = explode(" ",$s);
$catched=0;
if($limak_city>($cities_cnt/2)){
for ($i=0;$i<($limak_city);$i++){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<0)||($cities_cnt>=($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}else{
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}
}else{
	for ($i=$cities_cnt;$i>($limak_city);$i--){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<0)||($cities_cnt>=($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}else{
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}

}
if($crims[$limak_city]>0){
	$catched+=1;
}
echo $catched;

<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$cards = explode(" ",$s);
$cities_cnt=$cards[0];
$limak_city=$cards[1]-1;
$s =  trim(fgets($stdin));
$crims = explode(" ",$s);
$catched=0;
if($limak_city>($cities_cnt/2)){
for ($i=0;$i<($limak_city);$i++){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<0)||($cities_cnt>=($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}elseif($cities_cnt-($r+$r)>=0){
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}
}else{
	for ($i=$cities_cnt;$i>($limak_city);$i--){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<0)||($cities_cnt>=($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}else{
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}

}
if($crims[$limak_city]>0){
	$catched+=1;
}
echo $catched;

<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$cards = explode(" ",$s);
$cities_cnt=$cards[0];
$limak_city=$cards[1]-1;
$s =  trim(fgets($stdin));
$crims = explode(" ",$s);
$catched=0;
if($limak_city>($cities_cnt/2)){
for ($i=0;$i<($limak_city);$i++){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<0)||($cities_cnt>($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}elseif($cities_cnt-($r+$r)>=0){
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}
}else{
	for ($i=$cities_cnt;$i>($limak_city);$i--){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<0)||($cities_cnt>($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}else{
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}

}
if($crims[$limak_city]>0){
	$catched+=1;
}
echo $catched;

<?

$stdin = fopen('php://stdin', 'r');
$s =  trim(fgets($stdin));
$cards = explode(" ",$s);
$cities_cnt=$cards[0];
$limak_city=$cards[1]-1;
$s =  trim(fgets($stdin));
$crims = explode(" ",$s);
$catched=0;
if($limak_city>($cities_cnt/2)){
for ($i=0;$i<($limak_city);$i++){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<=0)||($cities_cnt>=($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}else{
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}
}else{
	for ($i=$cities_cnt;$i>($limak_city);$i--){

	$r = abs($limak_city-$i);
	if(($cities_cnt-($limak_city+$r)<=0)||($cities_cnt>=($limak_city+$r))){
		if(((int)$crims[$limak_city+$r])>0||((int)$crims[$limak_city-$r])>0){
			$catched+=1;
		}
	}else{
		if(((int)$crims[$limak_city+$r])>0&&((int)$crims[$limak_city-$r])>0){
			$catched+=2;
		}

	}
}

}
if($crims[$limak_city]>0){
	$catched+=1;
}
echo $catched;


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

#!/usr/bin/php
<?php

$string = trim(fgets(STDIN));
$current = 0;

for ($i = 0; $i < strlen($string); $i++) {
	if (ord($string[$i]) <= ($current + ord('a') - 1)) {

	} else if (ord($string[$i]) == ($current + ord('a'))) {
		$current++;
	} else {
		echo "NO";
		exit();
	}
}

echo "YES";
exit();

<?php

error_reporting(0);

while($line = trim(fgets(STDIN))){

$linhas[]=$line;
if($a==1) break;
$a++;
}

$alfabeto = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");

$str=$linhas[0];

$l=sizeof($alfabeto);

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

$firstLetter = $alfabeto[$i];

if($str[0]==$firstLetter) {

	$str = str_replace($firstLetter, "", $str);

	if(strlen($str) == 0) {
		die("YES");
	}

	continue;

}

else die("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";
?>

#!/usr/bin/php
<?php

$string = trim(fgets(STDIN));
$current = 0;

for ($i = 0; $i < strlen($string); $i++) {
	if (ord($string[$i]) <= ($current + ord('a'))) {

	} else if (ord($string[$i]) == ($current + ord('a') + 1)) {
		$current++;
	} else {
		echo "NO";
		exit();
	}
}

echo "YES";
exit();

<?php

error_reporting(0);

while($line = trim(fgets(STDIN))){

$linhas[]=$line;
if($a==2) break;
$a++;
}

$n=$linhas[0];
$home=$linhas[1];
$i=1;

while($i<$n) {

	$line2 = trim(fgets(STDIN));
	$i++;

}

if($n%2==0) {

echo "home";

}

else echo "contest";

?>


<?php
# 1177b
$k = trim(fgets(STDIN));
if ($k < 10) {
    echo $k;
} else {
    $powers =[0,0];
    $powCount = $digitCount = 0.0;

    for ($i = 0; $i < 12; $i++) {
        $powCount += 10 ** $i * 9;
        $digitCount += 10 ** $i * 9 * ($i + 1);
        if ($digitCount > $k) {
            break;
        }
        $powers = [$i+2, $powCount, $digitCount];
    }

    [$size, $powCount, $digitCount] = $powers;
    $shift = floor(($k - $digitCount) / $size);
    $shift_x = ceil(($k - $digitCount) / $size);
    $key = sprintf('%.0f', $k - $digitCount - ($shift * $size + 1));
    echo (sprintf('%.0f', $powCount + $shift_x))[$key];
}

<?php

$i = 0;
$str = '0';
do {
$i++;
$str .= $i;
} while(strlen($str) < 10000);

$d = trim(file_get_contents('php://stdin'));

echo $str[$d];

<?php
# 1177b
$stdin = STDIN;

$k = trim(fgets($stdin));
$str = '';
$length = 0;
for ($i = 1; $length <= $k; $i++) {
    $str .= $i;
    $length += strlen($i);
}
echo $str[$k - 1];

<?php

$i = 0;
$str = '';
do {
$i++;
$str .= $i;
} while(strlen($str) < 10000);

$d = trim(file_get_contents('php://stdin'));

echo $str[$d];

$i = 0;
$str = '';
do {
$i++;
$str .= $i;
while(strlen($str) < 10000);

$d = trim(file_get_contents('php://stdin'));

echo $str[$d];

<?php
# 1177b
$k = trim(fgets(STDIN));
if ($k < 10) {
    echo $k;
} else {
    $powers =[0,0];
    $powCount = $digitCount = 0;

    for ($i = 0; $i < 12; $i++) {
        $powCount += 10 ** $i * 9;
        $digitCount += 10 ** $i * 9 * ($i + 1);
        if ($digitCount > $k) {
            break;
        }
        $powers = [$i+2, $powCount, $digitCount];
    }

    [$size, $powCount, $digitCount] = $powers;
    $shift = (int)floor(($k - $digitCount) / $size);
    $shift_x = (int)ceil(($k - $digitCount) / $size);
    echo (sprintf('%.0f', $powCount + $shift_x))[$k - $digitCount - ($shift * $size + 1)];
}

<?php
# 1177b

$k = trim(fgets(STDIN));
if ($k < 10) {
    echo $k;
} else {
    $powers =[0,0];
    $powCount = $digitCount = 0;

    for ($i = 0; $i < 12; $i++) {
        $powCount += 10 ** $i * 9;
        $digitCount += 10 ** $i * 9 * ($i + 1);
        if ($digitCount > $k) {
            break;
        }
        $powers = [$i+2, $powCount, $digitCount];
    }

    [$size, $powCount, $digitCount] = $powers;
    $shift = (int)floor(($k - $digitCount) / $size);
    $shift_x = (int)ceil(($k - $digitCount) / $size);
    echo ((string)($powCount + $shift_x))[$k - $digitCount - ($shift * $size + 1)];
}

<?php
# 1177b
$k = trim(fgets(STDIN));
$powers =[0,0];
$powCount = $digitCount = 0;

for ($i = 0; $i < 12; $i++) {
    $powCount += 10 ** $i * 9;
    $digitCount += 10 ** $i * 9 * ($i + 1);
    if ($digitCount > $k) {
        break;
    }
    $powers = [$i+2, $powCount, $digitCount];
}

[$size, $powCount, $digitCount] = $powers;
$shift = (int)floor(($k - $digitCount) / $size);
$shift_x = (int)ceil(($k - $digitCount) / $size);
echo ((string)($powCount + $shift_x))[$k - $digitCount - ($shift * $size + 1)];


<?php

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

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

    if ($die) {
        die();
    }

    echo '</pre>';
}

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

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

/****************************************************** Solving block *****************************************************/
list($a, $b) = explode(' ', g());
$max = $a > $b ? $a : $b;
$max--;
$points = 6 - $max;

switch($points) {
    case 0: echo '0/1'; break;
    case 1: echo '1/6'; break;
    case 2: echo '1/3'; break;
    case 3: echo '1/2'; break;
    case 4: echo '2/3'; break;
    case 5: echo '5/6'; break;
    case 6: echo '1/1'; break;
}

?>

<?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 nod($a, $b) {
	while ($a <> 0 && $b <> 0) {
		if ($a > $b)
			$a = $a % $b;
		else
			$b = $b % $a;
		$nod = $a + $b;
	}
	return $nod;
}

function getAnswer($is_test = false, $f = false) {
	if ($is_test === false) {
		$f = STDIN;
	}
	/* begin body */
	list($n1, $n2) = readStringExplodeNum($f, ' ', true);

	$goodCnt = 6 - max($n1, $n2) + 1;
	$nod = nod($goodCnt, 6);
	$base = 6;
	$goodCnt/=$nod;
	$base/=$nod;

	echo "{$goodCnt}/{$base}";
	/* / end body */
}

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

<?php

$stdout = fopen(getenv("OUTPUT_PATH"), "w");
$stdin = fopen("php://stdin", "r");

fscanf($stdin, "%d %d" , $y , $w ) ;

$arr = [ "1/6" , "1/3" , "1/2" , "2/3" , "5/6" , "1/1" ] ;

$num = max( $y , $w ) ;

$probability = 6 - $num ;

echo $arr[ $probability ] ;

fwrite($stdout);

fclose($stdin);
fclose($stdout);

?>

<?php

$line = trim(fgets(STDIN));
$points = explode(" ", $line);

$maximum = max($points);

$P = (7 - $maximum)/6;

switch ($P) {
    case 0:
        $P = '0/1';
        break;
    case 1:
        $P = '1/1';
        break;
    case 1/6:
        $P = '1/6';
        break;
    case 2/6:
        $P = '1/3';
        break;
    case 3/6:
        $P = '1/2';
        break;
    case 4/6:
        $P = '2/3';
        break;
    case 5/6:
        $P = '5/6';
        break;
}

echo $P;
?>

<?php

	$stdin = fopen('php://stdin', 'r');;
	$data = trim(fgets($stdin));
    $arr = explode(" ", $data);
    $chance = max($arr);
    switch($chance){
        case 1: echo '1/1'; break;
        case 2: echo '5/6'; break;
        case 3: echo '2/3'; break;
        case 4: echo '1/2'; break;
        case 5: echo '1/3'; break;
        case 6: echo '1/6'; break;
    }

<?
$arr=explode(' ',trim(fgets(STDIN)));
$max[]=max($arr);
function gcd($a,$b) {
    while ($b) {
        $a%=$b;
        $a^=$b^=$a^=$b;
    }
    return $a;
}
for($i=$max[0];$i<6;$i++){
    $max[]=$i+1;
}
$size=sizeof($max);
$gcd=gcd($size,6);
echo $size/$gcd."/".(6/$gcd);
?>

<?php
$fh=trim(fgets(STDIN));
list($y,$w)=explode(" ",$fh);
function fmax($a, $b){
	if ($a > $b)return $a;
    else return $b;
}

function gcd($a,$b) {
	if ($b == 0)
		return $a;
	return gcd($b, $a % $b);
}
$r=6-fmax($y,$w)+1;
$g=gcd($r,6);
$a1=$r/$g;
$a2=6/$g;
echo(${a1}."/".${a2});
?>

<?php
list($y, $w) = explode(' ',trim(fgets(STDIN)));
if($y > $w) $m = $y; else $m = $w;
switch($m){
 case 1: print '1/1'; break;
 case 2: print '5/6'; break;
 case 3: print '2/3'; break;
 case 4: print '1/2'; break;
 case 5: print '1/3'; break;
 case 6: print '1/6'; break;
}
?>

<?
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);
$lines = trim($lines);
$nums=explode(" ", $lines);
$good=6-max($nums)+1;
$all=6;

for ($i=2; $i<=6; $i++)
if ($good%$i==0 and $all%$i==0)
{
    $good/=$i;
    $all/=$i;
}

$res="$good/$all";
echo $res;
?>

<?php
$line=trim(fgets(STDIN));
$eyes=explode(" ",$line);
$max=0;
for($i=0;$i<2;$i+=1){
   if($max < 0+$eyes[$i]){
     $max=0+$eyes[$i];
   }
}
$amari=6-$max+1;
$max=6;
$sosu=array(2,3);
for($i=0;$i<2;$i+=1){
   if($amari % $sosu[$i] == 0){
     $amari=$amari/$sosu[$i];
     $max=$max/$sosu[$i];
   }
}
print($amari."/".$max);
?>

<?php
	$fr = fopen("php://stdin","r");
	$input = fgets($fr);
	list( $y, $w ) = explode(' ', $input);
	fclose ($fr);

	$dice = 6;
	$r = min( $dice-$y, $dice-$w ) + 1;
	foreach ( array(2,3,4,5,6) as $d )
		if ( ($r % $d) == 0 )
		{
			$r /= $d;
			$dice /= $d;
		}
	echo $r.'/'.$dice;
?>

<?php
	$fr = fopen("php://stdin","r");
	$input = fgets($fr);
	list( $y, $w ) = explode(' ', $input);
	fclose ($fr);

	$dice = 6;
	$r = min( $dice-$y, $dice-$w ) + 1;
	if ( $r == 1 )
		die('0/1');
	foreach ( array(2,3,5) as $d )
	{
		while ( ($r % $d) == 0 )
		{
			$r /= $d;
			$dice /= $d;
		}
	}
	echo $r.'/'.$dice;
?>

<?php

$line = trim(fgets(STDIN));
$points = explode(" ", $line);

$maximum = max($points);

$P = (7 - $maximum)/6;

switch ($P) {
    case 0:
        $P = '0/0';
        break;
    case 1:
        $P = '1/1';
        break;
    case 1/6:
        $P = '1/6';
        break;
    case 2/6:
        $P = '2/6';
        break;
    case 3/6:
        $P = '3/6';
        break;
    case 4/6:
        $P = '4/6';
        break;
    case 5/6:
        $P = '5/6';
        break;
}

echo $P;
?>

<?php

$line = trim(fgets(STDIN));
$points = explode(" ", $line);

$maximum = max($points);

$P = (7 - $maximum)/6;

switch ($P) {
    case 0:
        $P = '0/1';
        break;
    case 1:
        $P = '1/1';
        break;
    case 1/6:
        $P = '1/6';
        break;
    case 2/6:
        $P = '2/6';
        break;
    case 3/6:
        $P = '3/6';
        break;
    case 4/6:
        $P = '4/6';
        break;
    case 5/6:
        $P = '5/6';
        break;
}

echo $P;
?>


<?php
/**
 * Author: 七柳先森
 * Date: 2016/1/26  9:13
 */
//组合数学问题。
fscanf(STDIN,"%d",$n);
$bans = array();
$line = stream_get_line(STDIN,1000000,"\n");
$line = rtrim($line);//去除右边的换行符。
$bans = explode(" ",$line);

//var_dump($bans);
$result = 0;
$prev = -1;
//连续的的找1，只有出现1的时候才能产生新组合。
//遇到一个1，就是前面的1的方案数，乘上到这个1的区间切割方案，也就是posi - posi-1
for($i = 0 ; $i < $n;$i++){
    if($bans[$i] == 1){
        if($prev == -1){
            $result = 1;
        }else{
            $result *= $i - $prev;
        }
        $prev = $i;
    }
}
fprintf(STDOUT,"%.0f",$result);

<?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
    $n = trim(fgets(STDIN));
    $a = explode(" ",trim(fgets(STDIN)));
    $sum = array_sum($a);
    if ($sum == 0)
    {
        echo("0");

    }
    else
    {
        $res = 1;
        $pre = -1;
        for ($i = 0 ; $i < $n ; $i ++)
        {
            if ($a[$i] == 1)
            {
                if ($pre != -1)
                {
                    $res *= $i - $pre;
                }
                $pre = $i ;
            }
        }

        echo(number_format($res,0,'',''));
    }

?>

<?php
    $n = trim(fgets(STDIN));
    $a = explode(" ",trim(fgets(STDIN)));
    $sum = array_sum($a);
    if ($sum == 0)
    {
        echo("0");

    }
    else
    {
        $res = 1;
        $pre = -1;
        for ($i = 0 ; $i < $n ; $i ++)
        {
            if ($a[$i] == 1)
            {
                if ($pre != -1)
                {
                    $res *= $i - $pre;
                }
                $pre = $i ;
            }
        }

        print($res);
    }

?>

<?php
    $n = trim(fgets(STDIN));
    $a = explode(" ",trim(fgets(STDIN)));
    $sum = array_sum($a);
    if ($sum == 0)
    {
        echo("0");

    }
    else
    {
        $res = 1;
        $pre = -1;
        for ($i = 0 ; $i < $n ; $i ++)
        {
            if ($a[$i] == 1)
            {
                if ($pre != -1)
                {
                    $res *= $i - $pre;
                }
                $pre = $i ;
            }
        }

        echo($res);
    }

?>

<?php
    $n = trim(fgets(STDIN));
    $a = explode(" ",trim(fgets(STDIN)));
    $sum = array_sum($a);
    if ($sum == 0)
    {
        echo("0");

    }
    else
    {
        $res = 1;
        $pre = -1;
        for ($i = 0 ; $i < $n ; $i ++)
        {
            if ($a[$i] == 1)
            {
                if ($pre != -1)
                {
                    $res *= $i - $pre;
                }
                $pre = i ;
            }
        }

        echo($res);
    }

?>

<?php
/**
 * Author: 七柳先森
 * Date: 2016/1/26  9:13
 */
//组合数学问题。
fscanf(STDIN,"%d",$n);
$bans = array();
$line = stream_get_line(STDIN,1000000,"\n");
$line = rtrim($line);//去除右边的换行符。
$bans = explode(" ",$line);

//var_dump($bans);
$result = 0;
$prev = -1;
//连续的的找1，只有出现1的时候才能产生新组合。
//遇到一个1，就是前面的1的方案数，乘上到这个1的区间切割方案，也就是posi - posi-1
for($i = 0 ; $i < $n;$i++){
    if($bans[$i] == 1){
        if($prev == -1){
            $result = 1;
        }else{
            $result *= $i - $prev;
        }
        $prev = $i;
    }
}
fprintf(STDOUT,"%d",$result);

<?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;
for($i=0; $i < $length; $i++) {
    if (!$countMode && ($nuts[$i] == '1')) {
        // $vars ++;
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
        continue;
    }

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

?>

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

?>

<?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;
for($i=0; $i < $length; $i++) {
    if (!$countMode && ($nuts[$i] == '1')) {
        // $vars ++;
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
        continue;
    }

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

echo $vars;

?>

<?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;
for($i=0; $i < $length; $i++) {
    if (!$countMode && ($nuts[$i] == '1')) {
        $vars ++;
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
        continue;
    }

    if ($countMode && ($nuts[$i] == '1')) {
        $vars = $vars + $tempVars;
        if ($i != ($length -1)) {
            $vars++;
        }
        $tempVars = 0;
    }
}

echo $vars;

?>

<?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')) {
        // $vars ++;
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
    }

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

        if ($nuts[$i+1] == '0') {
            $countMode = true;
        }
    }
    /*
    if ($i == ($length - 1)) {
        if ($tempVars > 0) {
            $vars ++;
        }
    }
    */
}
if ($vars == 0) {
    echo '1';
} else {
    echo $vars;
}

?>

<?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;
for($i=0; $i < $length; $i++) {
    if (!$countMode && ($nuts[$i] == '1')) {
        $vars ++;
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
        continue;
    }

    if ($countMode && ($nuts[$i] == '1')) {
        $vars = $vars + $tempVars;
        if (($i != ($length -1)) && ($tempVars > 0)) {
            $vars++;
        }
        $tempVars = 0;
    }
}

echo $vars;

?>

<?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')) {
        // $vars ++;
        $countMode = true;
        continue;
    }
    if ($countMode && ($nuts[$i] == 0)) {
        $tempVars ++;
        continue;
    }

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

?>


<?php
	function gao($c)
	{
		switch($c)
		{
			case '>':
				return "8";
			case '<':
				return "9";
			case '+':
				return "10";
			case '-':
				return "11";
			case '.':
				return "12";
			case ',':
				return "13";
			case '[':
				return "14";
			case ']':
				return "15";
		}
	}
	$stdin = fopen("php://stdin", "r");
	$str = fgets($stdin);
	$len = strlen($str);
	$num = "0";
	for($i = 0; $i < $len-1; $i++)
	{
		$num = bcmul($num, "16");
		$num = bcadd($num, gao($str[$i]));
	}
	echo (bcmod($num, "1000003"))."\n";
?>


<?php
$f = fopen ("php://stdin", 'r' ) ;
$a_win =0;
$b_win =0;
$draw =0;

$lines = file("php://stdin");
function parseint($n){
    return(intval($n));
}

$a_b = array_map("parseint", explode(" ",(strval($lines[0]))));

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

     if(abs($a_b[0] - $i ) < abs($a_b[1] - $i )){
         $a_win++;

     }
     elseif(abs($a_b[0] - $i ) > abs($a_b[1] - $i )){
         $b_win++;

     }
     else{
         $draw++;
         }

 }

 print $a_win . " " . $draw . " " .$b_win ;

?>

<?php

$f = fopen("php://stdin", 'r');
list($a, $b) = fscanf($f, "%d %d");
fclose($f);

$result = array(0, 0, 0);

for ($j = 1; $j <= 6; $j++) {
	if (abs($a - $j) < abs($b - $j)) {
		$result[0]++;
	}
	elseif (abs($a - $j) > abs($b - $j)) {
		$result[2]++;
	}
	elseif (abs($a - $j) == abs($b - $j)) {
		$result[1]++;
	}

}

print implode(' ', $result);

<?php

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

$a = intval($a);
$b = intval($b);

$winf = 0;
$draw = 0;
$wins = 0;

for ($i = 1; $i <= 6; $i ++) {
  $diffa = abs($i - $a);
  $diffb = abs($i - $b);
  if ($diffa < $diffb) {
    $winf ++;
  } elseif ($diffa > $diffb) {
    $wins ++;
  } else {
    $draw ++;
  }
}

print $winf . ' ' . $draw . ' ' . $wins;

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

<?php
error_reporting("off");
//378A: Playing with Dice
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$awins = 0;
$bwins = 0;
$tie = 0;
for ($i = 1; $i <= 6; $i++) {
    if (abs($a - $i) < abs($b - $i)) {
        $awins++;
    } elseif (abs($a - $i) > abs($b - $i)) {
        $bwins++;
    } else {
        $tie++;
    }
}

echo $awins." ".$tie." ".$bwins;
?>

<?php
error_reporting("off");
//378A: Playing with Dice
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$awins = 0;
$bwins = 0;
$tie = 0;
for ($i = 1; $i <= 6; $i++) {
    if (abs($a - $x) < abs($b - $x)) {
        $awins++;
    } elseif (abs($a - $x) > abs($b - $x)) {
        $bwins++;
    } else {
        $tie++;
    }
}

echo $awins." ".$tie." ".$bwins;
?>


<?php
$handle = fopen ("php://stdin","r");
$lines = array();
$lines[0] = fgets($handle);
$lines[1] = fgets($handle);
fclose($handle);

$v_girl_fingers = explode(" ", $lines[0]);
$m_boy_fingers = explode(" ", $lines[1]);

for( $i = 0; $i < 2; $i++ ) {
	$v_girl_finger = (int)$v_girl_fingers[$i];
	$m_boy_finger = (int)$m_boy_fingers[1-$i];

#	var_dump($v_girl_finger);
#	var_dump($m_boy_finger);
#	var_dump('===================');
	if ( $v_girl_finger >= (ceil($m_boy_finger/2)-1) && $v_girl_finger <= ($m_boy_finger + 1) ) {
		echo "YES";
		exit(0);
	}
}

echo "NO";
exit(0);

<?php
list($al, $ar) = explode(' ',trim(fgets(STDIN)));
list($bl, $br) = explode(' ',trim(fgets(STDIN)));

if((($bl - 2) / $ar <= 2 && $ar - $bl <= 1 ) || (($br - 2) / $al <= 2 && $al - $br <= 1 ))
 print 'YES'; else print 'NO';
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
list($c, $d) = explode(" ", trim(fgets(STDIN)));
$e = max($a, $d);
$f = max($c, $b);
$g = min($a, $d);
$h = min($c, $b);
if((($e - $g) <= 1) || (($f - $h) <= 1))
{
    print "YES";
}
else
{
    print "NO";
}
?>

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
list($c, $d) = explode(" ", trim(fgets(STDIN)));
$e = $a;
$e--;
$f = $e * 2;
$g = $b;
$g--;
$h = $g * 2;
if($a > 1)
{
     if($d <= $f)
     {
          print "YES";
     }
     else
     {
          if($b > 1)
          {
               if($c <= $h)
               {
                    print "YES";
               }
               else
               {
                    print "NO";
               }
          }
     }
}
else
{
     if($b > 1)
     {
          if($c <= $h)
          {
               print "YES";
          }
          else
          {
               print "NO";
          }
     }
     else
     {
          print "NO";
     }
}
?>

<?php

$lines = explode("\n", $argv[1]);
$v_girl_fingers = explode(" ", $lines[0]);
$m_boy_fingers = explode(" ", $lines[1]);

for( $i = 0; $i < 2; $i++ ) {
	$v_girl_finger = $v_girl_fingers[$i];
	$m_boy_finger = $m_boy_fingers[1-$i];

#	var_dump($v_girl_finger);
#	var_dump($m_boy_finger);
#	var_dump('===================');
	if ( ($v_girl_finger > $m_boy_finger - 2 && $v_girl_finger <= $m_boy_finger + 1)
	  && ($m_boy_finger < $v_girl_finger + 1 && $m_boy_finger >= $v_girl_finger - 1 ) ) {
		echo "YES";
		exit(0);
	}
}

echo "NO";
exit(0);

<?php
 var_dump($argv);
$lines = explode("\n", $argv[1]);
$v_girl_fingers = explode(" ", $lines[0]);
$m_boy_fingers = explode(" ", $lines[1]);

for( $i = 0; $i < 2; $i++ ) {
	$v_girl_finger = $v_girl_fingers[$i];
	$m_boy_finger = $m_boy_fingers[1-$i];

#	var_dump($v_girl_finger);
#	var_dump($m_boy_finger);
#	var_dump('===================');
	if ( ($v_girl_finger > $m_boy_finger - 2 && $v_girl_finger <= $m_boy_finger + 1)
	  && ($m_boy_finger < $v_girl_finger + 1 && $m_boy_finger >= $v_girl_finger - 1 ) ) {
		echo "YES";
		exit(0);
	}
}

echo "NO";
exit(0);

<?php
$handle = fopen ("php://stdin","r");
$lines = array();
$lines[0] = fgets($handle);
$lines[1] = fgets($handle);
fclose($handle);

$v_girl_fingers = explode(" ", $lines[0]);
$m_boy_fingers = explode(" ", $lines[1]);

for( $i = 0; $i < 2; $i++ ) {
	$v_girl_finger = (int)$v_girl_fingers[$i];
	$m_boy_finger = (int)$m_boy_fingers[1-$i];

#	var_dump($v_girl_finger);
#	var_dump($m_boy_finger);
#	var_dump('===================');
	if ( ($v_girl_finger >= $m_boy_finger - 2 && $v_girl_finger <= $m_boy_finger + 1)
	  && ($m_boy_finger <= $v_girl_finger + 1 && $m_boy_finger >= $v_girl_finger - 1 ) ) {
		echo "YES";
		exit(0);
	}
}

echo "NO";
exit(0);

<?php
$handle = fopen ("php://stdin","r");
$lines = array();
$lines[0] = fgets($handle);
$lines[1] = fgets($handle);
fclose($handle);

$v_girl_fingers = explode(" ", $lines[0]);
$m_boy_fingers = explode(" ", $lines[1]);

for( $i = 0; $i < 2; $i++ ) {
	$v_girl_finger = $v_girl_fingers[$i];
	$m_boy_finger = $m_boy_fingers[1-$i];

#	var_dump($v_girl_finger);
#	var_dump($m_boy_finger);
#	var_dump('===================');
	if ( ($v_girl_finger > $m_boy_finger - 2 && $v_girl_finger <= $m_boy_finger + 1)
	  && ($m_boy_finger < $v_girl_finger + 1 && $m_boy_finger >= $v_girl_finger - 1 ) ) {
		echo "YES";
		exit(0);
	}
}

echo "NO";
exit(0);

<?php
$handle = fopen ("php://stdin","r");
$lines = array();
$lines[0] = fgets($handle);
$lines[1] = fgets($handle);
fclose($handle);

$v_girl_fingers = explode(" ", $lines[0]);
$m_boy_fingers = explode(" ", $lines[1]);

for( $i = 0; $i < 2; $i++ ) {
	$v_girl_finger = (int)$v_girl_fingers[$i];
	$m_boy_finger = (int)$m_boy_fingers[1-$i];

#	var_dump($v_girl_finger);
#	var_dump($m_boy_finger);
#	var_dump('===================');
	if ( $v_girl_finger >= (ceil($m_boy_finger/2)-1) && $v_girl_finger <= ($m_boy_finger + 2) ) {
		echo "YES";
		exit(0);
	}
}

echo "NO";
exit(0);

<?php
list($al, $ar) = explode(' ',trim(fgets(STDIN)));
list($bl, $br) = explode(' ',trim(fgets(STDIN)));

if(($bl - $ar <= 3 && $ar - $bl <= 1 ) || ($br - $al <= 3 && $al - $br <= 1 ))
 print 'YES'; else print 'NO';
?>


<?php
$input = explode(" ", trim(fgets(STDIN)));
$sum = array_sum($input);
echo (($sum%5!=0 || $sum==0) ? -1 : ($sum/5));
?>

<?php
$player = explode(" ",trim(fgets(STDIN)));
$summ =0;
for ($i=0;$i<count($player);$i++)
{
    $summ+=$player[$i];
}
if ($summ%5==0&&$summ!=0)echo $summ/5;
else echo -1;

<?php
	$input = explode(" ",trim(fgets(STDIN)));
	$sum = array_sum($input);
	if($sum%5==0 && $sum>0){
		echo $sum/5;
	}
	else{
		echo "-1";
	}
?>

<?

$input = trim(fgets(STDIN));

$cs = explode(' ', $input);

$sum = array_sum($cs);

if(($sum/5)==ceil($sum/5)&&$sum!=0){
    echo ($sum/5);
}else{
    echo -1;
}

?>

<?php
// 478A     Начальная ставка
$in = fopen("php://stdin", 'r');

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

$sum = 0;
foreach ($arr as $key => $value) {
    $sum += (int) $value;
}

if ((($sum % 5) !== 0) or ($sum == 0)) {
    echo -1;
} else {
    echo $sum / 5;
}

?>

<?php

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

$a = (int)$raw[0];
$b = (int)$raw[1];
$c = (int)$raw[2];
$d = (int)$raw[3];
$e = (int)$raw[4];

$count = $a + $b + $c + $d + $e;

if ($count % 5 != 0 || $count == 0) {
    echo -1 . PHP_EOL;
} else {
    echo $count / 5 . PHP_EOL;
}

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

<?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
$a = explode(" ", trim(fgets(STDIN)));
$b = array_sum($a);
$c = $b % 5;
$d = $b / 5;
if($b == 0)
{
    print "0";
}
elseif($c == 0)
{
    print $d;
}
else
{
    print "-1";
}
?>

<?php
$a = explode(" ", trim(fgets(STDIN)));
$b = array_sum($a);
$c = $b % 5;
$d = $b / 5;
if($c == 0)
{
    print $d;
}
else
{
    print "-1";
}
?>

<?php
$input = explode(" ", trim(fgets(STDIN)));
$sum = array_sum($input);
echo (($sum%5 || !sum) ? -1 : ($sum/5));
?>

<?php
    $s = 0;
    for ($i = 1; $i <= 5; $i++)    {
        fscanf(STDIN, "%d\n", $number);
        $s += $number;
    }

    if ($s % 5 == 0)
    {
        fprintf(STDOUT, "%d\n", $s / 5);
    }
    else {
        fprintf(STDOUT, "-1\n");
    }
?>

<?php
$player = explode(" ",trim(fgets(STDIN)));
$summ =0;
for ($i=0;$i<count($player);$i++)
{
    $summ+=$player[$i];
}
if ($summ%5==0)echo $summ/5;
else echo -1;

<?php
	$input = explode(" ",trim(fgets(STDIN)));
	$sum = array_sum($input);
	if($sum%5==0 && $sum>0){
		echo "$sum/5";
	}
	else{
		echo "-1";
	}
?>

<?

$input = trim(fgets(STDIN));

$cs = explode(' ', $input);

$sum = array_sum($cs);

if(($sum/5)==ceil($sum/5)){
    echo ($sum/5);
}else{
    echo -1;
}

?>

<?php
// 478A     Начальная ставка
$in = fopen("php://stdin", 'r');

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

$sum = 0;
foreach ($arr as $key => $value) {
    $sum += (int) $value;
}

if (($sum % 5) == 0) {
    echo $sum / 5;
} else {
    echo -1;
}

?>

<?php

$line = fgets(STDIN);
$ex = explode(" ",$line);

$sum = $ex[0] + $ex[1] + $ex[2] + $ex[3] + $ex[4];
if($sum % 5 == 0){
    echo $sum / 5;
}else{
    echo -1;
}

<?php

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

$a = (int)$raw[0];
$b = (int)$raw[1];
$c = (int)$raw[2];
$d = (int)$raw[3];
$e = (int)$raw[4];

$count = $a + $b + $c + $d + $e;

if ($count % 5 != 0) {
    echo -1 . PHP_EOL;
} else {
    echo $count / 5 . PHP_EOL;
}


<?php
$n = trim(fgets(STDIN));
$ti = explode(" ", trim(fgets(STDIN)));
sort($ti);
$r = false;
$b = 0;
for ($j = 0; $j < $n - 1; $j++) {
    if ($ti[$j+1] - $ti[$j] == 1) {
        $b++;
    } else if ($ti[$j+1] - $ti[$j] == 0) {
        continue;
    } else {
        $b = 0;
    }
    if ($b == 2) $r = true;
}
if ($r) {
    print "YES";
} else {
    print "NO";
}
?>

<?php
$n = trim(fgets(STDIN));
$ti = explode(" ", trim(fgets(STDIN)));
sort($ti);
$r = false;
$b = 0;
for ($j = 0; $j < $n - 1; $j++) {
    if ($ti[$j+1] - $ti[$j] == 1) {
        $b++;
    } else {
        $b = 0;
    }
    if ($b == 2) $r = true;
}
if ($r) {
    print "YES";
} else {
    print "NO";
}
?>


<?php

error_reporting(0);

while($line = trim(fgets(STDIN))){

$linhas[]=$line;
if($a==1) break;
$a++;
}

$explode = explode(" ",$linhas[0]);

$k=$explode[0];
$a=$explode[1];
$b=$explode[2];

$max = max($a,$b);
$min = min($a,$b);

$set1 = $max/$k;
$set2 = $min/$k;

$sum = intval($set1)+intval($set2);

$sum+=0;

$resto1=$max%$k;
$resto2=$min%$k;

if($resto1!=0 && $max>=$k) {

	if($min >= $k) {

		echo $sum;
		die();

	}

}

else if(($resto1==0) && ($max>=$k)) {
	echo $sum; die(); }

	// var_dump($resto1==0,$max>=$k);

echo "-1";

?>

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


<?
    define ("TEST", false);
    if (TEST) $GLOBALS['file'] = fopen('input.txt', 'r');
    else $GLOBALS['file'] = fopen('php://stdin', 'r');
    function debug($var){echo '<pre>'; print_r($var); echo '</pre>';}
    function read_str(){return trim(fgets($GLOBALS['file']));}
    function read_array(){return explode(' ', read_str());}
    /***************************************************************/

    $n = read_str();

    function find_max($n)
    {
        $max = $n/2;
        $a=1;
        do
        {
            $a++;
            $b = $n/$a;
            if(is_int($b)) break;
        } while ($a<$max);
        if($a>$max) return 1;
        else return max($a,$b);
    }

    function calc($n)
    {
        $count = $n;
        do
        {
            $n = find_max($n);
            $count += $n;
        } while($n != 1);

        return $count;
    }

    echo calc($n);
?>

<?
    define ("TEST", false);
    if (TEST) $GLOBALS['file'] = fopen('input.txt', 'r');
    else $GLOBALS['file'] = fopen('php://stdin', 'r');
    function debug($var){echo '<pre>'; print_r($var); echo '</pre>';}
    function read_str(){return trim(fgets($GLOBALS['file']));}
    function read_array(){return explode(' ', read_str());}
    /***************************************************************/

    $n = read_str();

/**
 * Checks if $num is a Prime Number
 * @param int $num
 * @return boolean
 */
function isPrime($num) {
    //1 is not prime. See: http://en.wikipedia.org/wiki/Prime_number#Primality_of_one
    if($num == 1)
        return false;

    //2 is prime (the only even number that is prime)
    if($num == 2)
        return true;

  /**
     * if the number is divisible by two, then it's not prime and it's no longer
     * needed to check other even numbers
     */
    if($num % 2 == 0) {
        return false;
    }

    /**
     * Checks the odd numbers. If any of them is a factor, then it returns false.
     * The sqrt can be an aproximation, hence just for the sake of
     * security, one rounds it to the next highest integer value.
     */
    for($i = 3; $i <= ceil(sqrt($num)); $i = $i + 2) {
        if($num % $i == 0)
            return false;
    }

    return true;
}

    function find_max($n)
    {
        if(isPrime($n)) return 1;
        $max = $n/2;
        $a=1;
        do
        {
            $a++;
            $b = $n/$a;

            if(is_int($b)) break;
        } while ($a<$max);
        if($a>$max) return 1;
        else return max($a,$b);
    }

    function calc($n)
    {
        $count = $n;
        do
        {
            $n = find_max($n);

            $count += $n;
        } while($n != 1);

        return $count;
    }

    echo calc($n);
?>


<?php
fscanf(STDIN,"%d %d",$arrSize,$k);
$arr=explode(' ',trim(fgets(STDIN)));
$trgtArr[0]=$arr[0];
$l=1;
$m=1;
$key[0]=1;
for ($i=1; $i <$arrSize ; $i++)
{
	$count=0;
     for ($j=0; $j <count($trgtArr); $j++)
     {
     	if($trgtArr[$j]!=$arr[$i])
     	{
     		$count++;
     		if($count==count($trgtArr))
     		{
     			$trgtArr[$l++]=$arr[$i];
     			$key[$m++]=$i+1;
     		}
     	}
     }
}
if(count($key)>=$k)
  {
	echo "YES\n";
	for ($i=0; $i <count($key) ; $i++)
	 {
		if($i==$k-1)
		{
			echo "$key[$i]";
			break;
		}
		else
			echo "$key[$i] ";
	}
  }
	else
		echo "NO\n";

<?php
$debug=0;
$b=readline ("n k:");
$a=readline ("ratings:");
$arr1=explode(" ",$b);
$a=explode(" ",$a);
$n=($arr1[0]);
$k=($arr1[1]);
($debug) ? print ($n . "\r\n"): "";
($debug) ? print ($k . "\r\n"): "";
($debug) ? print_r ($a): "" ;
$uniq=array_unique($a);
$out=[];

if (count($uniq)>=$k):
        foreach ($uniq as $value) {
                for ($i=0;$i<=$k+1;$i++){
                        if ($a[$i] == $value):
                        $out[]=$i+1;
                        $i=0;
                        break;
                        endif;
                }
        }

        print ("YES\r\n");
        print (implode(" ",$out));
else:
        print("NO");
endif;

<?php
$debug=0;
$b=readline ("n k:");
$a=readline ("ratings:");
$arr1=explode(" ",$b);
$a=explode(" ",$a);
$n=($arr1[0]);
$k=($arr1[1]);
($debug) ? print ($n . "\r\n"): "";
($debug) ? print ($k . "\r\n"): "";
($debug) ? print_r ($a): "" ;
$uniq=array_unique($a);
$out=[];

if (count($uniq)>=$k):
        foreach ($uniq as $value) {
                for ($i=0;$i<=$k;$i++){
                        if ($a[$i] == $value):
                        $out[]=$i;
                        break;
                        endif;
                }
        }

        print ("YES\r\n");
        print (implode(" ",$out));
else:
        print("NO");
endif;

<?php
$debug=0;
$b=readline ("n k:");
$a=readline ("ratings:");
$arr1=explode(" ",$b);
$a=explode(" ",$a);
$n=($arr1[0]);
$k=($arr1[1]);
($debug) ? print ($n . "\r\n"): "";
($debug) ? print ($k . "\r\n"): "";
($debug) ? print_r ($a): "" ;
$uniq=array_unique($a);
$out=[];

if (count($uniq)>=$k):
        foreach ($uniq as $value) {
                for ($i=0;$i<=$k+1;$i++){
                        if ($a[$i] == $value):
                        $out[]=$i+1;
                        break;
                        endif;
                }
        }

        print ("YES\r\n");
        print (implode(" ",$out));
else:
        print("NO");
endif;

<?php
$debug=0;
$b=readline ("n k:");
$a=readline ("ratings:");
$arr1=explode(" ",$b);
$a=explode(" ",$a);
$n=($arr1[0]);
$k=($arr1[1]);
($debug) ? print ($n . "\r\n"): "";
($debug) ? print ($k . "\r\n"): "";
($debug) ? print_r ($a): "" ;
$uniq=array_unique($a);
$out=[];

if (count($uniq)>=$k):
        foreach ($uniq as $value) {
                for ($i=0;$i<=$k;$i++){
                        if ($a[$i] == $value):
                        $out[]=$i+1;
                        break;
                        endif;
                }
        }

        print ("YES\r\n");
        print (implode(" ",$out));
else:
        print("NO");
endif;

<?php
fscanf(STDIN,"%d %d",$arrSize,$k);
$arr=explode(' ',trim(fgets(STDIN)));
$trgtArr[0]=$arr[0];
$l=1;
$m=1;
$key[0]=1;
for ($i=1; $i <$arrSize ; $i++)
{
	$count=0;
     for ($j=0; $j <count($trgtArr); $j++)
     {
     	if($trgtArr[$j]!=$arr[$i])
     	{
     		$count++;
     		if($count==count($trgtArr))
     		{
     			$trgtArr[$l++]=$arr[$i];
     			$key[$m++]=$i+1;
     		}
     	}
     }
}
if(count($key)==$k)
  {
	echo "YES\n";
	for ($i=0; $i <count($key) ; $i++)
	 {
		if($i==$k-1)
			echo "$key[$i]";
		else
			echo "$key[$i] ";
	}
  }
	else
		echo "NO\n";


<?php
$__fp = fopen('php://stdin', 'r');
$a = array_map('intval', explode(' ', fgets($__fp)));
sort($a);
if ($a[0] + $a[3] == $a[1] + $a[2]) {
    echo 'YES' . PHP_EOL;
} else {
    echo 'NO' . PHP_EOL;
}

<?php
$line=explode(" ",trim(fgets(STDIN)));
$first=$line[0]+$line[1];
$second=$line[2]+$line[3];
$third=$line[1]+$line[2];
$fourth=$line[0]+$line[3];
$fifth=$line[0]+$line[2];
$sixth=$line[1]+$line[3];
if($first==$second||$third==$fourth||$fifth==$sixth)
	echo "YES";
else
	echo "NO";


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

$line = trim(fgets($fileIN));
$line = explode(" ", $line);
$n = $line[0];
$k = $line[1];

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

$a = array();

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

for ($i = 0; $i < $k; ++$i) {
    for ($j = $line[$i]; $j <= $n; ++$j) {
        if ($a[$j] == 0) {
            $a[$j] = $line[$i];
        }
    }
}

for ($i = 1; $i <= $n; ++$i) {
    fprintf($fileOUT, $a[$i] . " ");
}

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

<?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
define('LOCAL_ENV', false);
if (LOCAL_ENV) {
    error_reporting(E_ALL & !E_NOTICE);
    $test = <<<INPUT
5 4
4 3 1 2
INPUT;
    $stdin = fopen('php://temp/in', 'rw');
    fwrite($stdin, $test);
    rewind($stdin);
} else {
    error_reporting(0);
    $stdin = STDIN;
}
define('MY_STDIN', $stdin);

list($n,$m) = explode(' ', trim(fgets(MY_STDIN)));
$a = explode(' ', trim(fgets(MY_STDIN)));
$aa = array_fill(1, $n, 0);
foreach ($a as $k) {
    for ($i = $k; $i <= $n; $i++) {
        if ($aa[$i] == 0) {
            $aa[$i] = $k;
        }
    }
}
echo join(' ', $aa);

<?php
define('LOCAL_ENV', false);
if (LOCAL_ENV) {
    error_reporting(E_ALL & !E_NOTICE);
    $test = <<<INPUT
5 5
5 4 3 2 1
INPUT;
    $stdin = fopen('php://temp/in', 'rw');
    fwrite($stdin, $test);
    rewind($stdin);
} else {
    error_reporting(0);
    $stdin = STDIN;
}
define('MY_STDIN', $stdin);

list($n,$m) = explode(' ', trim(fgets(MY_STDIN)));
$a = explode(' ', trim(fgets(MY_STDIN)));
var_dump($a);
$aa = array_fill(1, $n, 0);
foreach ($a as $k) {
    for ($i = $k; $i <= $n; $i++) {
        if ($aa[$i] == 0) {
            $aa[$i] = $k;
        }
    }
}
echo join(' ', $aa);

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

$line = trim(fgets($fileIN));
$line = explode(" ", $line);
$n = $line[0];
$k = $line[1];

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

$a = array();

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

for ($i = 0; $i < $k; ++$i) {
    for ($j = $line[$i]; $j <= $n; ++$j) {
        if ($a[$j] == 0) {
            $a[$j] = $line[$i];
        }
    }
}

for ($i = 1; $i <= $n; ++$i) {
    fprintf($fileOUT, $a[$i] . " ");
}

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


<?php
$in=fgets(STDIN);
$in2=fgets(STDIN);
$in2=trim($in2);

$strArr=explode("|", $in);
$str1=trim($strArr[0]);
$str2=trim($strArr[1]);
$len1=strlen($str1);
$len2=strlen($str2);

$del=abs($len1-$len2);
$lend=strlen($in2);

if($lend<$del) {echo "Impossible";
exit();
}

if($del%2!=$lend%2) echo "Impossible";
else{
	while(strlen($in2)!=0){
		$len1=strlen($str1);
		$len2=strlen($str2);
		if($len1<$len2){
			$str1=$str1.$in2[0];
			$in2=substr($in2, 1);
		}else if($len1>$len2){
			$str2=$str2.$in2[0];
			$in2=substr($in2, 1);
		}else{
			$str1=$str1.$in2[0];
			$str2=$str2.$in2[1];
			$in2=substr($in2, 2);
		}

	}
	echo $str1."|".$str2;
}

?>


<?php
$input2=trim(fgets(STDIN));
settype($input2,'string');
$input=explode(' ',$input2);
$num=$input[0];
$jame=$input[1];
$v=str_repeat('0',$num-1);
$min='1'.$v;
$mino=str_split($min);
if( $jame == 0 and $num!=1){
      echo "-1 -1";
      exit;
}
if($num * 9 < $jame ){
echo "-1 -1";
exit;
}
$max=str_repeat('9',$num);
$q=$num-1;
$a=$jame-1;
$maxo=str_split($max);
while ($a>=9) {
      $mino[$q]+=9;
      $a-=9;
      $q--;
}
$mino[$q]+=$a;
$x=join('',$mino);
echo $x;
echo "\n";
$s=$jame;
$q2=$num-1;
$i=0;
$maxo=str_split(str_repeat('0',$num));
while ($s >=9 and $i <$num) {
      $maxo[$i]+=9;
      $s-=9;
      $i++;
}
if($s !=0){
      @$maxo[$i]+=$s;
}
$y=join('',$maxo);
echo $y;

<?php
$num=trim(fgets(STDIN));
settype($num,'string');
$jame=trim(fgets(STDIN));
settype($jame,'string');
$v=str_repeat('0',$num-1);
$min='1'.$v;
$mino=str_split($min);
if($num * 9 < $jame){
echo "-1 -1";
exit;
}
$max=str_repeat('9',$num);
$q=$num-1;
$a=$jame-1;
$maxo=str_split($max);
while ($a>=9) {
      $mino[$q]+=9;
      $a-=9;
      $q--;
}
$mino[$q]+=$a;
$x=join('',$mino);
echo $x;
echo "\n";
$s=$jame;
$q2=$num-1;
$i=0;
$maxo=str_split(str_repeat('0',$num));
while ($s >=9 and $i <$num) {
      $maxo[$i]+=9;
      $s-=9;
      $i++;
}
if($s !=0){
      @$maxo[$i]+=$s;
}
$y=join('',$maxo);
echo $y;

<?php
$num=trim(fgets(STDIN));
settype($num,'string');
$jame=trim(fgets(STDIN));
settype($jame,'string');
$v=str_repeat('0',$num-1);
$min='1'.$v;
$mino=str_split($min);

$max=str_repeat('9',$num);
$q=$num-1;
$a=$jame-1;
$maxo=str_split($max);
while ($a>=9) {
      $mino[$q]+=9;
      $a-=9;
      $q--;
}
$mino[$q]+=$a;
echo join('',$mino);
echo "\n";
$s=$jame;
$q2=$num-1;
$i=0;
$maxo=str_split(str_repeat('0',$num));
while ($s >=9 and $i <$num) {
      $maxo[$i]=9;
      $s-=9;
      $i++;
}
@$maxo[$i]+=$s;
echo join('',$maxo);

<?php
$input2=trim(fgets(STDIN));
settype($input2,'string');
$input=explode(' ',$input2);
$num=$input[0];
$jame=$input[1];
$v=str_repeat('0',$num-1);
$min='1'.$v;
$mino=str_split($min);
if($num * 9 < $jame  or $jame == 0){
echo "-1 -1";
exit;
}
$max=str_repeat('9',$num);
$q=$num-1;
$a=$jame-1;
$maxo=str_split($max);
while ($a>=9) {
      $mino[$q]+=9;
      $a-=9;
      $q--;
}
$mino[$q]+=$a;
$x=join('',$mino);
echo $x;
echo "\n";
$s=$jame;
$q2=$num-1;
$i=0;
$maxo=str_split(str_repeat('0',$num));
while ($s >=9 and $i <$num) {
      $maxo[$i]+=9;
      $s-=9;
      $i++;
}
if($s !=0){
      @$maxo[$i]+=$s;
}
$y=join('',$maxo);
echo $y;


<?php
$a = str_split(trim(fgets(STDIN)));
$b = str_split(trim(fgets(STDIN)));
$ans = "";
for($i=0;$i<count($a);$i++){
    if ($a[$i] != $b[$i])
        $ans .= "1";
    else
        $ans .= "0";
}
echo $ans;
?>

<?php

$a = trim(fgets(STDIN));
$b = trim(fgets(STDIN));

for($i=0;$i<strlen($a);$i++) print ($a[$i]==$b[$i]?'0':'1');
?>

<?
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);

$lines=trim($lines);
$lines=explode("\n", $lines);

$first=trim($lines[0]);
$second=trim($lines[1]);
for ($i=0; $i<strlen($first); $i++)
    echo ($first{$i}!=$second{$i})?'1':'0';

?>

<?php
error_reporting("off");
//61A: Ultra-Fast Mathematician
$one = str_split(trim(fgets(STDIN))); //$one = str_split("000");
$two = str_split(trim(fgets(STDIN))); //$two = str_split("111");
$length = count($one);
$result = "";
for ($i = 0; $i < $length; $i++) {
    if ($one[$i] !== $two[$i]) {
        $result .="1";
    } else {
        $result .="0";
    }
}
echo $result;
?>

<?php
    $fp = fopen('php://stdin', 'r');
    $a = rtrim(fgets($fp));
    $b = rtrim(fgets($fp));
    $c = '';

    $len = strlen($a);
    for($i = 0; $i < $len; $i++)
        $c .= (int)($a[$i] xor $b[$i]);
    echo $c;
?>

<?php

if (getenv('APPLICATION_ENV') == 'development') {
    $inputStream = STDIN;
    $outputStream = STDOUT;
} else {
    $inputStream = STDIN;
    $outputStream = STDOUT;
}

$input = trim(fgets($inputStream));
$input2 = trim(fgets($inputStream));

$out = '';

for ($i = 0; $i < strlen($input); $i++) {
    $out .= $input{$i} != $input2{$i} ? '1' : '0';
}

fwrite($outputStream, $out);

if (getenv('APPLICATION_ENV') == 'development') {
    fclose($inputStream);
    fclose($outputStream);
}

<?php
    fscanf(STDIN, "%s", $a);
    fscanf(STDIN, "%s", $b);

    for ($i = 0; $i < strlen($a); $i++){
        if ($a[$i]  == $b[$i]){
            echo 0;
        }
        else {
            echo 1;
        }
    }

<?php
    fscanf(STDIN, "%s", $a);
    fscanf(STDIN, "%s", $b);
    $arr = array();
        for ($i = 0; $i < strlen($a); $i++){
            if ($a[$i]  == $b[$i]){
                $arr[$i] = 0;
            }
            else $arr[$i] = 1;
            echo $arr[$i];
        }

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

$COUNT = 0;
$xy = array();
foreach (input() as $line) {
    $q = $line;

    array_push($xy, array_map('intval',str_split($q)));

    if (++$COUNT > 1) {
        break;
    }
}

for($i = 0; $i<count($xy[0]); ++$i) {
    echo $xy[0][$i] ^ $xy[1][$i];
}

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

$COUNT = 0;
$xy = array();
foreach (input() as $line) {
    $q = $line;

    // array_push($xy, array_map('intval',str_split($q)));
    array_push($xy, $q);

    if (++$COUNT > 1) {
        break;
    }
}

for($i = 0; $i<strlen($xy[0]); ++$i) {
    echo intval($xy[0][$i])^intval($xy[1][$i]);
}

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

$COUNT = 0;
$xy = array();
foreach (input() as $line) {
    $q = $line;

    // array_push($xy, array_map('intval',str_split($q)));
    array_push($xy, $q);

    if (++$COUNT > 1) {
        break;
    }
}

for($i = 0; $i<strlen($xy[0]); ++$i) {
   if ($xy[0][$i] != $xy[1][$i])
        echo 1;
    else {
        echo 0;
    }
}

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

$COUNT = 0;
$xy = array();
foreach (input() as $line) {
    if ($COUNT == 0) {
        $r1 = $line;
        ++$COUNT;
        continue;
    }
    // $q = $line;

    // array_push($xy, array_map('intval',str_split($q)));
    // array_push($xy, $q);
    for ($i = 0; $i < strlen($r1); ++$i) {
        if ($r1[$i] != $line[$i]) {
            echo 1;
        } else {
            echo 0;
        }
    }

    if (++$COUNT > 1) {
        break;
    }
}

<?php
/*
 * A. Быстрый математик
 */

$s1 = trim(fgets(STDIN));
$s2 = trim(fgets(STDIN));
$output = array();

for( $i=0; $i<strlen($s1); $i++ ){
    if( $s1[$i] != $s2[$i] ){
        $output[] = 1;
    }else{
        $output[] = 0;
    }
}
echo implode('',$output);

<?php
$fl=STDIN;//fopen("input.txt","r");
$a=trim(fgets($fl));
$b=trim(fgets($fl));
for($i=0;$i<strlen($a);++$i)
    printf("%d",((int)($a[$i])^(int)($b[$i])));
printf("\n");
?>

<?php
$a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
for($i=0;$i<strlen($a);++$i)
    printf("%d",((int)($a[$i])^(int)($b[$i])));
printf("\n");
?>

<?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
$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
fscanf(STDIN,"%s",$str1);
fscanf(STDIN,"%s",$str2);
$str3="";
for($i=0;$i<strlen($str1);$i++)
{

		if($str1[$i]==$str2[$i])
		{
			$str3.=0;

		}

		else	$str3.=1;

	}
echo $str3;

<?php
$one=readline();
$two=readline();
//$one = '1010100';
$one = str_split($one);
//$two = '0100101';
$two = str_split($two);
$i = 0;
$summa = array();
foreach ($one as $v) {
    if ($v==$two[$i]){
        array_push($summa, "0");
        $i++;
    } else {
        array_push($summa, "1");
        $i++;
    }
}
echo implode($summa);

<?php
    define('DEBUG', 0);

    if(DEBUG) $GLOBALS['file'] = fopen('input.txt', 'r');
    function debug($var){echo '<pre>';print_r($var);echo '</pre>';}
    function read_line()
    {
        if(DEBUG) { $file = $GLOBALS['file'];$line = trim(fgets($file));}
        else $line = trim(fgets(STDIN));
        return $line;
    }
    function get_array($line){return explode(' ', $line);}
    function read_array(){return get_array(read_line());}
    //echo "$s\n";
    /*****************************************************************/

    $line1 = read_line();
    $line2 = read_line();
    $len = strlen($line1);

    for ($i=0; $i<$len; $i++)
    {
        $char1 = $line1[$i];
        $char2 = $line2[$i];

        if($char1 == $char2) echo '0';
        else echo '1';
    }
?>

<?php
$str1 = trim(fgets(STDIN));
$str2 = trim(fgets(STDIN));

for ($i = 0; $i < strlen($str1); $i++)
    echo $str1[$i] === $str2[$i] ? "0" : "1";
?>

<?php

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

$first_line = explode("\n",$input)[0];
$second_line = explode("\n",$input)[1];

$given_str = "";

//Loop Throw Them.
for($i = 0;$i < strlen($first_line) - 1;$i++) {

   if($first_line[$i] != $second_line[$i]) {

        $given_str .= "1";

   }else {

        $given_str .= "0";

   }

}

echo $given_str;

<?php
// 61A  Быстрый математик
$in = fopen("php://stdin", 'r');

$str1 = fgets($in);
$str2 = fgets($in);
//list($n, $t) = preg_split('/ /', $input_line, -1, PREG_SPLIT_NO_EMPTY);
$len = strlen($str1) - 2;

$out = '';

for ($i=0; $i < $len ; $i++) {
    if ($str1[$i] === $str2[$i]) {
        $out .= '0';
    } else {
        $out .= '1';
    }
}

echo $out;

?>

<?php
$aNums = explode("\n", stream_get_contents(fopen("php://stdin", 'r')));
for($i = 0; $i < strlen($aNums[0])-1; $i++){
if($aNums[0][$i] == $aNums[1][$i]) $aNums[2] .= 0; else $aNums[2] .= 1;
}
echo $aNums[2];
?>

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

$COUNT = 0;
$xy = array();
foreach (input() as $line) {
    $q = $line;

    // array_push($xy, array_map('intval',str_split($q)));
    array_push($xy, $q);

    if (++$COUNT > 1) {
        break;
    }
}

for($i = 0; $i<strlen($xy[0]); ++$i) {
    echo $xy[0][$i] ^ $xy[1][$i];
}

<?php

$a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
for($i=0;$i<strlen($a);++$i)
    printf("%d",$a[$i]^$b[$i]);
printf("\n");


<?php
function calc()
{
    $board = array();
    for ($i = 0; $i < 8; $i++)
    {
        $board[$i] = rtrim(fgets(STDIN));
    }
    if (calc2($board)) echo "WIN\n";
    else echo "LOSE\n";
}

function calc2($board)
{
    $now = array_fill(0, 8, array());
    $now[7][0] = true;
    for ($turn = 0; $turn < 30; $turn++)
    {
        $next = array_fill(0, 8, array());
        for ($y = 0; $y < 8; $y++)
        {
            for ($x = 0; $x < 8; $x++)
            {
                if ($y - $turn >= 0 && $board[$y - $turn][$x] == 'S') continue;
                if ($y - ($turn + 1) >= 0 && $board[$y - ($turn + 1)][$x] == 'S') continue;
                for ($vy = -1; $vy <= 1; $vy++)
                {
                    for ($vx = -1; $vx <= 1; $vx++)
                    {
                        $ny = $y + $vy;
                        $nx = $x + $vx;
                        if (ok($ny, $nx) && $now[$ny][$nx])
                        {
                            $next[$y][$x] = true;
                            if ($board[$y][$x] == 'A') return true;
                        }
                    }
                }
            }
        }
        $now = $next;
    }
    return false;
}

function ok($y, $x)
{
    return $x >= 0 && $y >= 0 && $x < 8 && $y < 8;
}

calc();
?>

<?php
$board = array();
function calc()
{
    global $board;
    for ($i = 0; $i < 8; $i++)
    {
        $board[$i] = rtrim(fgets(STDIN));
    }
    if (dfs(7, 0, 0)) echo "WIN\n";
    else echo "LOSE\n";
}

function dfs($y, $x, $turn)
{
    global $board;
    if ($y - $turn >= 0 && $board[$y - $turn][$x] == 'S') return false;
    if ($turn >= 8) return true;
    for ($vy = -1; $vy <= 1; $vy++)
    {
        for ($vx = -1; $vx <= 1; $vx++)
        {
            $ny = $y + $vy;
            $nx = $x + $vx;
            if ($ny < 0 || $ny >= 8 || $nx < 0 || $ny >= 8) continue;
            if ($ny - $turn >= 0 && $board[$ny - $turn][$nx] == 'S') continue;
            if (dfs($ny, $nx, $turn + 1)) return true;

        }
    }
    return false;
}

calc();
?>

<?php
$board = array();
function calc()
{
    for ($i = 0; $i < 8; $i++)
    {
        $board[$i] = rtrim(fgets(STDIN));
    }
    if (dfs(7, 0, 0)) echo "WIN\n";
    else echo "LOSE\n";
}

function dfs($y, $x, $turn)
{
    if ($y - $turn >= 0 && $board[$y - $turn][$x] == 'S') return false;
    if ($turn >= 8) return true;
    for ($vy = -1; $vy <= 1; $vy++)
    {
        for ($vx = -1; $vx <= 1; $vx++)
        {
            $ny = $y + $vy;
            $nx = $x + $vx;
            if ($ny < 0 || $ny >= 8 || $nx < 0 || $ny >= 8) continue;
            if ($ny - $turn >= 0 && $board[$ny - $turn][$nx] == 'S') continue;
            if (dfs($ny, $nx, $turn + 1)) return true;

        }
    }
    return false;
}

calc();
?>

<?php
$board = array();
function calc()
{
    for ($i = 0; $i < 8; $i++)
    {
        $board[$i];
    }
    if (dfs(7, 0, 0)) echo "WIN\n";
    else echo "LOSE\n";
}

function dfs($y, $x, $turn)
{
    if ($y - $turn >= 0 && $board[$y - $turn][$x] == 'S') return false;
    if ($turn >= 8) return true;
    for ($vy = -1; $vy <= 1; $vy++)
    {
        for ($vx = -1; $vx <= 1; $vx++)
        {
            $ny = $y + $vy;
            $nx = $x + $vx;
            if ($ny < 0 || $ny >= 8 || $nx < 0 || $ny >= 8) continue;
            if ($ny - $turn >= 0 && $board[$ny - $turn][$nx] == 'S') continue;
            if (dfs($ny, $nx, $turn + 1)) return true;

        }
    }
    return false;
}

calc();
?>

<?php
$area = array();
for( $i=0; $i<8; $i++) {
    $area[$i] = trim(fgets(STDIN));
}

$x = 0;
$y = 7;
$i = 0;
while(1) {
    if( is_free_point(($x+1),($y-1),$area) &&
        !is_danger_point(($x+1),($y-1),$area) ) {
        set_round($x,$y,$x+1,$y-1,$area);
        $x++;$y--;
    }
    else if( is_free_point(($x+1),($y),$area) &&
        !is_danger_point(($x+1),($y),$area) ) {
        set_round($x,$y,$x+1,$y,$area);
        $x++;
    }
    else if( is_free_point(($x),($y-1),$area) &&
        !is_danger_point(($x),($y-1),$area) ) {
        set_round($x,$y,$x,$y-1,$area);
        $y--;
    }
    else {
        set_round($x,$y,$x,$y,$area);
    }
}

function set_round($x1, $y1, $x2, $y2, &$area) {
    if($x2==7 && $y2==0) {
        die('WIN');
    }
    else {
        $area[$y1][$x1] = '.';
        $area[$y2][$x2] = 'M';
    }
    move_enemy($area);
}

function move_enemy(&$area) {
    for($x=0;$x<8;$x++) {
        for($y=7;$y>=0;$y--) {
            if(in_array($area[$y][$x], array('S'))) {
                $area[$y][$x] = '.';
                if($y+1 <= 7) {
                    if(in_array($area[$y+1][$x], array('M'))) {
                        die('LOSE');
                    }
                    $area[$y+1][$x] = 'S';
                }
            }
        }
    }
}

function is_free_point($x,$y, $area) {
    if(valid_point($x, $y)) {
        if(in_array($area[$y][$x], array('.','A','M'))) {
            return TRUE;
        }
    }
    return FALSE;
}

function is_danger_point($x,$y,$area) {
    if( valid_point($x,($y-1) ) === FALSE || is_free_point($x, ($y-1) , $area) ) {
        return FALSE;
    }
    return TRUE;
}

function valid_point($x,$y) {
    if($x > 7 || $y > 7 || $x < 0 || $y < 0) {
        return FALSE;
    }
    return TRUE;
}

<?php
$area = array();
for( $i=0; $i<8; $i++) {
    $area[$i] = trim(fgets(STDIN));
}

$x = 0;
$y = 7;
$i = 0;
while(1) {
    if( is_free_point(($x+1),($y-1),$area) &&
        !is_danger_point(($x+1),($y-1),$area) ) {
        set_round($x,$y,$x+1,$y-1,$area);
        $x++;$y--;
    }
    else if( is_free_point(($x+1),($y),$area) &&
        !is_danger_point(($x+1),($y),$area) ) {
        set_round($x,$y,$x+1,$y,$area);
        $x++;
    }
    else if( is_free_point(($x-1),($y-1),$area) &&
        !is_danger_point(($x-1),($y-1),$area) ) {
        set_round($x,$y,$x-1,$y-1,$area);
        $x--;$y--;
    }
    else if( is_free_point(($x),($y-1),$area) &&
        !is_danger_point(($x),($y-1),$area) ) {
        set_round($x,$y,$x,$y-1,$area);
        $y--;
    }
    else if( is_free_point(($x),($y+1),$area) &&
        !is_danger_point(($x),($y+1),$area) ) {
        set_round($x,$y,$x,$y+1,$area);
        $y++;
    }
    else {
        set_round($x,$y,$x,$y,$area);
    }
}

function set_round($x1, $y1, $x2, $y2, &$area) {
    if($x2==7 && $y2==0) {
        die('WIN');
    }
    else {
        $area[$y1][$x1] = '.';
        $area[$y2][$x2] = 'M';
    }
    move_enemy($area);
}

function move_enemy(&$area) {
    for($x=0;$x<8;$x++) {
        for($y=7;$y>=0;$y--) {
            if(in_array($area[$y][$x], array('S'))) {
                $area[$y][$x] = '.';
                if($y+1 <= 7) {
                    if(in_array($area[$y+1][$x], array('M'))) {
                        die('LOSE');
                    }
                    $area[$y+1][$x] = 'S';
                }
            }
        }
    }
}

function is_free_point($x,$y, $area) {
    if(valid_point($x, $y)) {
        if(in_array($area[$y][$x], array('.','A','M'))) {
            return TRUE;
        }
    }
    return FALSE;
}

function is_danger_point($x,$y,$area) {
    if( valid_point($x,($y-1) ) === FALSE || is_free_point($x, ($y-1) , $area) ) {
        return FALSE;
    }
    return TRUE;
}

function valid_point($x,$y) {
    if($x > 7 || $y > 7 || $x < 0 || $y < 0) {
        return FALSE;
    }
    return TRUE;
}


<?php
$a = trim(fgets(STDIN));
$b = bcmod($a, 2);
$c = floor(bcdiv($a, 2));
if($b == 0)
{
    print bcdiv($a, 2);
}
else
{
    print "-" . bcsub(bcdiv($a, 2), -1);
}
?>

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

	if (bcmod($n, "2")!=0) {
		echo "-";
		echo bcadd(bcdiv($n,2,0), "1");
	}else{
		echo bcdiv($n,"2",0);
	}
?>

<?php
$n = trim(fgets(STDIN));
$ans = (bcmod($n, 2) != 0 ? bcadd(bcdiv($n, -2), -1) : bcdiv($n, 2));
echo $ans;
?>

<?php

/**
 * @author Sunwarul Islam
 */

$n = trim(fgets(STDIN));
$lastDigit = $n[strlen($n) - 1];
if ($lastDigit % 2 == 0) {
    echo sprintf("%.0f", ($n / 2));
}
if ($lastDigit % 2 != 0) {
    echo sprintf("%.0f", (- ($n + 1) / 2));
}

echo "\n";

<?php
    fscanf(STDIN,"%s",$n);
    if (bcmod($n, '2') != 0) {
        echo '-';
        echo bcadd(bcdiv($n, 2, 0), '1', 0);
    }
    else
        echo bcdiv($n, '2', 0);

<?php
// 486A     Подсчёт функции
$in = fopen("php://stdin", 'r');

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

$len = strlen($input_line);
$char = $input_line[$len-1];
$k = (int) $char;

if (($k % 2) == 0) {
    echo bcdiv($input_line, '2');
} else {
    for ($i=$len-1; $i >= 0 ; $i--) {
        $char = $input_line[$i];
        if ($char === '9') {
            $input_line[$i] = '0';
        } else {
            $k = (int) $char;
            $k ++;
            $input_line[$i] = (string) $k;
            break;
        }
    }
    if ($i < 0) {
        echo '-' . bcdiv('1'.$input_line, '2');
    } else {
        echo '-' . bcdiv($input_line, '2');
    }
}

?>

<?php
$n = trim(fgets(STDIN));
if (bcmod($n,'2')!=0)echo '-'.bcdiv(bcadd($n,'1'),'2');
else echo bcdiv($n,'2');

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

if(bcmod($n,2)==0)
	echo bcdiv($n, 2);
else
echo "-".bcdiv(bcadd($n,1), 2);

<?php
$a = trim(fgets(STDIN));
$b = bcmod($a, 2);
$c = floor(bcdiv($a, 2));
if($b == 0)
{
    print bcdiv($a, 2);
}
else
{
    print "-" . bcsub(bcdiv($a, 2), 1);
}
?>

<?php
$a = trim(fgets(STDIN));
$b = bcmod($a, 2);
$c = floor(bcdiv($a, 2));
if($b == 0)
{
    print bcdiv($a, 2);
}
else
{
    print bcsub($c, $a);
}
?>

<?php
$a = trim(fgets(STDIN));
$b = bcmod($a, 2);
$c = floor(bcdiv($a, 2));
if($b == 0)
{
    print bcdiv($a, 2);
}
else
{
    print "-" . ceil(bcdiv($a, 2));
}
?>

<?php
$a = trim(fgets(STDIN));
$b = $a % 2;
$c = floor($a / 2);
if($b == 0)
{
    print $a / 2;
}
else
{
    print $c - $a;
}
?>

<?php
$a = trim(fgets(STDIN));
$b = $a % 2;
if($b == 0)
{
    print $a / 2;
}
else
{
    print "-" . ceil($a / 2);
}
?>

<?php
$a = trim(fgets(STDIN));
$b = bcmod($a, 2);
if($b == 0)
{
    print bcdiv($a, 2);
}
else
{
    $c = bcdiv($a, 2);
    print "-" . ($c + 1);
}
?>

<?php
$a = trim(fgets(STDIN));
$b = bcmod($a, 2);
$c = floor(bcdiv($a, 2));
if($b == 0)
{
    print bcdiv($a, 2);
}
else
{
    print "-" . bcdiv($a, 2) - 1;
}
?>

<?php
	$input = trim(fgets(STDIN));
	echo ($input%2==0)?number_format(($input/2),16):number_format(floor($input/2*-1),16);
?>

<?php
	$input = trim(fgets(STDIN));
	echo ($input%2==0)?($input/2):($input/2*-1);
?>

<?php
	$input = trim(fgets(STDIN));
	$sum = 0;
	for($i=1;$i<$input;$i++)
	{
		$multiplier = ($i%2==1)?-1:1;
		$sum = $sum + ($multiplier * $i);
	}
	echo $sum;
?>

<?php
	$input = trim(fgets(STDIN));
	echo ($input%2==0)?($input/2):floor($input/2*-1);
?>

<?php
	$input = trim(fgets(STDIN));
	echo ($input%2==0)?sprintf('%.0f',($input/2)):sprintf('%.0f',floor($input/2*-1));
?>

<?php
    fscanf(STDIN,"%d",$n);
    if ($n % 2 != 0)
        echo '-';
    echo ceil($n / 2);

<?php
$n = fgets(STDIN);
if (($n%2)==0) echo bcdiv($n,2);
else echo bcdiv(-($n+1),2);

<?php
$n = trim(fgets(STDIN));
if (bcmod($n,2)==0) echo bcdiv($n,2);
else echo bcdiv(-($n+1),2);

<?php
$n = trim(fgets(STDIN));
if (($n%2)==0) echo bcdiv($n,2);
else echo bcdiv(-($n+1),2);

<?php
$n = trim(fgets(STDIN));
if ($n%2==0) echo ($n/2);
else echo -1*($n+1)/2;

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

if(bcmod($n,2)==0)
	echo bcdiv($n, 2);
else
echo "-".bcdiv($n+1, 2);

<?php
$str=trim(fgets(STDIN));
if($str%2==0)
{
	echo bcdiv($str,2);
}
else
    echo ceil(bcdiv($str,2,2))*(-1);

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

if($n%2==0)
	echo bcdiv($n, 2);
else
echo "-".bcdiv($n, 2)-1;

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

if($n%2==0)
	echo $n/2;
else
echo "-".ceil($n/2);

<?php
$n = trim(fgets(STDIN));
$ans = ($n % 2 == 0 ? bcdiv($n, 2) : bcadd(bcdiv($n, -2), -1));
echo $ans;
?>

<?php
$n = trim(fgets(STDIN));
$ans = ($n % 2 == 0 ? bcdiv($n, 2) : bcadd(bcdiv($n, -3), -1));
echo $ans;
?>

<?php
$n = trim(fgets(STDIN));
$ans = ($n % 2 != 0 ? bcadd(bcdiv($n, -2), -1) : bcdiv($n, 2));
echo $ans;
?>

<?php
// 486A     Подсчёт функции
$in = fopen("php://stdin", 'r');

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

$char = substr($input_line, strlen($input_line)-1, 1);
$k = (int) $char;

$n = (int) $input_line;

if (($k % 2) == 0) {
    echo $n / 2;
} else {
    echo ($n + 1) / (-2);

}

?>

<?php

/**
 * @author Sunwarul Islam
 */

$n = trim(fgets(STDIN));

if ($n % 2 == 0) {
    echo sprintf("%.0f", ($n / 2));
}
if ($n % 2 != 0) {
    echo sprintf("%.0f", (- ($n + 1) / 2));
}

echo "\n";

<?php

/**
 * @author Sunwarul Islam
 */
error_reporting(0);
$n = fgets(STDIN);
if ($n % 2 === 0) echo sprintf("%.0f", ($n / 2));
if ($n % 2 !== 0) echo sprintf("%.0f", (- ($n + 1) / 2));

echo "\n";

<?php

/**
 * @author Sunwarul Islam
 */

$n = fgets(STDIN);
if ($n % 2 == 0) echo sprintf("%.0f", ($n / 2));
if ($n % 2 != 0) echo sprintf("%.0f", (- ($n + 1) / 2));

echo "\n";

<?php

/**
 * @author Sunwarul Islam
 */

$n = fgets(STDIN);
if ($n % 2 === 0) echo sprintf("%.0f", ($n / 2));
if ($n % 2 !== 0) echo sprintf("%.0f", (- ($n + 1) / 2));

echo "\n";


<?php
fscanf(STDIN,"%s %s %s",$d1,$d2,$d3);
echo min(bcmul(2,bcadd($d1,$d2)),bcadd($d3,bcadd($d1,$d2)),bcmul(2,bcadd($d1,$d3)),bcmul(2,bcadd($d2,$d3)));


<?php
$a = trim(fgets(STDIN));
$b = 1;
$c = array($a => 1);
while(TRUE)
{
     $a = intval($a);
     $a += 1;
     while(TRUE)
     {
          $a = strval($a);
          if($a[strlen($a) - 1] == 0)
          {
               $a = substr($a, 0, -1);
          }
          else
          {
               break;
          }
     }
     if($c[$a] == 1)
     {
          break;
     }
     else
     {
          $b++;
          $c[$a] = 1;
     }
}
print $b;
?>

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

function f($n){
	$n++;
	while($n % 10 == 0) { $n /= 10; }
	return $n;
}

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

$a = [];

$c = 0;

while($c < 10000) { $n = f($n); $a[] = $n; $c++; }

$a = array_unique($a);

if(in_array($n0, $a)) echo count($a); else echo count($a)+1;

<?php

function f($n){
	$n++;
	while($n % 10 == 0) $n /= 10;
	return $n;
}

$n = trim(fgets(STDIN));

$c = 1;

while($n > 1) { $n = f($n); $c++; }

echo $c;

<?php
    $n = trim(fgets(STDIN));
    $a = str_split($n);
    print_r($a);
    $i = 2;
    foreach ($a AS $v) {
            $i += 9 - $v;
    }
    echo $i;
?>

<?php
    $n = trim(fgets(STDIN));
    $a = str_split($n);
    $i = count($a) == 1 ? 1 : 2;
    foreach ($a AS $v) {
            $i += 9 - $v;
    }
    echo $i;
?>

<?php
    $n = trim(fgets(STDIN));
    $a = str_split($n);
    $i = 2;
    foreach ($a AS $v) {
            $i += 9 - $v;
    }
    echo $i;
?>


<?php
    $stdin = fopen("php://stdin", "r");
    $n = trim(fgets(STDIN));
    $arr = explode(" ", trim(fgets(STDIN)));
    fclose($stdin);

    $flag = false;

    sort($arr);

    for($i=0; $i<$n-2; $i++)
    {
        if(
            $arr[$i] + $arr[$i+1]>$arr[$i+2] &&
            $arr[$i+2] + $arr[$i+1]>$arr[$i] &&
            $arr[$i] + $arr[$i+2]>$arr[$i+1])
        {
            $flag = true;
            break;
        }
    }
    echo ($flag ? "YES" : "NO") . PHP_EOL;
?>

<?php
	$n = trim(fgets(STDIN)) ;
	$arr = explode(" " , trim(fgets(STDIN))) ;
	$check = false;
	sort($arr) ;
	for ($i=2; $i < count($arr); $i++) {
		if($arr[$i] < $arr[$i-1] +  $arr[$i-2])
			$check = true ;
	}
	if($check)
		echo "YES\n" ;
	else
		echo "NO\n";

?>

<?php

error_reporting(0);

while($line = trim(fgets(STDIN))){

$linhas[]=$line;
if($a==1) break;
$a++;
}

$arrayValores=explode(" ",$linhas[1]);
$n=$linhas[0];

rsort($arrayValores);

$i=0;

$alvo = $arrayValores[sizeof($arrayValores) - 1];

while($i<$n) {

$max=$arrayValores[$i];
$secMax = $arrayValores[$i+1];

$arrayValores = array_slice($arrayValores,1,null,TRUE);
$a=0;

foreach($arrayValores as $valor){

	if($a==0) {$a=1; continue;}

	if(($valor+$secMax>$max)) {
		echo "YES";
		die();	}

}

$i++;

}

echo "NO";

?>

<?php

error_reporting(0);

while($line = trim(fgets(STDIN))){

$linhas[]=$line;
if($a==1) break;
$a++;
}

$arrayValores=explode(" ",$linhas[1]);

rsort($arrayValores);

$i=0;

$alvo = $arrayValores[sizeof($arrayValores) - 2];

while(TRUE) {

$max=$arrayValores[$i];
$secMax = $arrayValores[$i+1];

if($max==$alvo) {echo "NO"; break;}

$arrayValores = array_slice($arrayValores,1,null,TRUE);
$a=0;

foreach($arrayValores as $valor){

	if($a==0) {$a=1; continue;}

	if(($valor+$secMax>$max)) {
		echo "YES";
		break 2;
	}

}

$i++;

}

?>

<?php

error_reporting(0);

while($line = trim(fgets(STDIN))){

$linhas[]=$line;
if($a==1) break;
$a++;
}

$arrayValores=explode(" ",$linhas[1]);

rsort($arrayValores);

$i=0;

$alvo = $arrayValores[sizeof($arrayValores) - 2];

while(TRUE) {

$max=$arrayValores[$i];
$secMax = $arrayValores[$i+1];

if($max==$alvo) {echo "NO"; break;}

$arrayValores = array_slice($arrayValores,1,null,TRUE);
$a=0;

foreach($arrayValores as $valor){

	if($a==0) {$a=1; continue;}

	if($valor+$secMax>=$max) {
		echo "YES";
		break 2;
	}

}

$i++;

}

?>

<?php

error_reporting(0);

while($line = trim(fgets(STDIN))){

$linhas[]=$line;
if($a==1) break;
$a++;
}

$arrayValores=explode(" ",$linhas[1]);

rsort($arrayValores);

$i=0;

$alvo = $arrayValores[sizeof($arrayValores) - 1];

while(TRUE) {

$max=$arrayValores[$i];
$secMax = $arrayValores[$i+1];

if($max==$alvo) {echo "NO"; break;}

$arrayValores = array_slice($arrayValores,1,null,TRUE);
$a=0;

foreach($arrayValores as $valor){

	if($a==0) {$a=1; continue;}

	if(($valor+$secMax>$max)) {
		echo "YES";
		break 2;
	}

}

$i++;

}

?>

<?php
    $stdin = fopen("php://stdin", "r");
    $n = trim(fgets(STDIN));
    $arr = explode(" ", trim(fgets(STDIN)));
    fclose($stdin);

    $flag = false;

    for($i=0; $i<$n-2; $i++)
    {
        if(
            $arr[$i] + $arr[$i+1]>$arr[$i+2] &&
            $arr[$i+2] + $arr[$i+1]>$arr[$i] &&
            $arr[$i] + $arr[$i+2]>$arr[$i+1])
        {
            $flag = true;
            break;
        }
    }
    echo ($flag ? "YES" : "NO") . PHP_EOL;
?>


<?php
	// God & me
	// I found myself in Love empire !
	$INPUTS = preg_split("/[\s]+/", file_get_contents('php://stdin'));
	function in(){
	    static $i = 0;
	    global $INPUTS;
	    return $INPUTS[$i++];
	}
	$vx = in(); $vy = in(); $vz = in(); $x = in(); $y = in(); $z = in();
	$ans = 0;
	$cur = in();
	if($vy < 0)  $ans += $cur;
	$cur = in();
	if($vy > $y)  $ans += $cur;
	$cur = in();
	if($vz < 0)  $ans += $cur;
	$cur = in();
	if($vz > $z)  $ans += $cur;
	$cur = in();
	if($vx < 0)  $ans += $cur;
	$cur = in();
	if($vx > $x)  $ans += $cur;
	echo $ans;
?>


<?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
    $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);
          $d = array_keys($b);

          $max = max($d)-1;
          $min = min($d)+1;
          if(reset($b) < 2) {
                if(in_array($max, $d) || in_array($min, $d)){
                    echo 1;
                } else {
                    echo 2;
                }
          } else {
              echo 1;
          }
      }
  }

 ?>

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

          $max = max($d)-1;
          $min = min($d)+1;
          if(reset($b) < 2) {
                if(in_array($max, $d) || in_array($min, $d)){
                    echo 1;
                } else {
                    echo 2;
                }
          } else {
              echo 1;
          }
      }
  }

 ?>

<?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];
          }
      }
      if(max($a) - min($a) == 0) {
          echo 0;
      } else if (max($a) - min($a) == 2) {
          echo 1;
      } else if (max($a) - min($a) > 2){
          $b = array_count_values($a);
          if($b[0] < 2) {
              echo 2;
          } else {
              echo 1;
          }
      }
  }

 ?>


<?php

    function gao($a, $b) {
        if($a > $b) return ($a-$b-($a-$b)%2)/2;
        else
            return $a-$b;
    }

    fscanf(STDIN, "%d%d%d", $a, $b, $c);
    fscanf(STDIN, "%d%d%d", $x, $y, $z);
    //echo $a, $b, $c;
    //echo $x, $y, $z;
    $ans = 0;
    $ans = $ans + gao($a, $x);// echo $ans , "\n";
    $ans += gao($b, $y);// echo $ans , '\n';
    $ans += gao($c, $z);// echo $ans , '\n';
    echo $ans >= 0 ? "Yes" : "No";

?>

<?php

$handle = fopen("php://stdin", "r");
fscanf($handle, "%d %d %d %d %d %d", $a, $b, $c, $x, $y, $z);
echo $a, $b, $c;
echo $x, $y, $z;

?>

<?php

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

?>

<?php

    function gao($a, $b) {
        if($a > $b) return intdiv($a-$b, 2);
        else return $b-$a;
    }

    fscanf(STDIN, "%d%d%d", $a, $b, $c);
    fscanf(STDIN, "%d%d%d", $x, $y, $z);
    $ans = 0;
    $ans += gao(a, x);
    $ans += gao(b, y);
    $ans += gao(c, z);
    echo $ans >= 0 ? "Yes" : "No";

?>

<?php

    function gao($a, $b) {
        if($a > $b) return ($a-$b-$a%$b)/2;
        else
            return $a-$b;
    }

    fscanf(STDIN, "%d%d%d", $a, $b, $c);
    fscanf(STDIN, "%d%d%d", $x, $y, $z);
    //echo $a, $b, $c;
    //echo $x, $y, $z;
    $ans = 0;
    $ans = $ans + gao($a, $x);
    $ans += gao($b, $y);
    $ans += gao($c, $z);
    echo $ans >= 0 ? "Yes" : "No";

?>


<?
$arr=explode(' ',trim(fgets(STDIN)));
foreach ($arr as $val){
    $newarr[]=ceil($val/2);
}
$max=max($newarr);
$res=30+($max*3-1);
for($i=2;$i>0;$i--){
    if($newarr[$i]==$max) {
        $pos=$i;
        break;
    }
}
switch($pos){
    case 2: $minus=0; break;
    case 1: $minus=1; break;
    case 0: $minus=2; break;
}
echo $res-$minus;
?>


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

$res = '';

foreach (str_split($s) as $i => $ch) {
  $ch = (int)$ch;
  if ($ch >= 5) {
    if ($i != 0 || $ch != 9) {
      $ch = 9 - $ch;
    }
  }
  $res .= $ch;
}

echo "$res\n";

<?php
// 514A     Чубакка и число
$in = fopen("php://stdin", 'r');

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

//list($x1, $y1, $x2, $y2) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

$str = substr($input_line, 0, strlen($input_line)-2);
$len = strlen($str);

for ($i=0; $i < $len; $i++) {
    if ($str[$i] > '4') {
        $str[$i] = (string) (9 - (int) $str[$i]);
    }
}

for ($i=0; $i < $len; $i++) {
    if ($str[$i] !== '0') {
        break;
    } else {
        $str[$i] = '9';
        break;
    }
}

echo $str;

?>

<?php

$f = fopen('php://stdin', 'r');
//$f = fopen('test.txt', 'r');

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

$result = '';

for($i=0;$i<strlen($s);$i++){

    if ($i==0 && $s[$i]=='9'){
        $result.=$s[$i];
        continue;
    }

    if ($s[$i]>4){
        $t = (9 - $s[$i]);
        $result=$result.$t;
    } else $result.=$s[$i];
}

if ($result=='0') exit($s);

echo $result;

<?php
// 514A     Чубакка и число
$in = fopen("php://stdin", 'r');

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

//list($x1, $y1, $x2, $y2) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

$str = substr($input_line, 0, strlen($input_line)-2);
$len = strlen($str);

for ($i=0; $i < $len; $i++) {
    if ($str[$i] > '4') {
        $str[$i] = (string) (9 - (int) $str[$i]);
    }
}

for ($i=0; $i < $len; $i++) {
    if ($str[$i] !== '0') break;
}

if ($i == $len) {
    echo "0";
} else {
    echo substr($str, $i);
}

?>

<?php
// 514A     Чубакка и число
$in = fopen("php://stdin", 'r');

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

//list($x1, $y1, $x2, $y2) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

$str = substr($input_line, 0, strlen($input_line)-2);
$strold = $str;
$len = strlen($str);

for ($i=0; $i < $len; $i++) {
    if ($str[$i] > '4') {
        $str[$i] = (string) (9 - (int) $str[$i]);
    }
}

for ($i=0; $i < $len; $i++) {
    if ($str[$i] !== '0') break;
}

if ($i == $len) {
    echo $strold;
} else {
    echo substr($str, $i);
}

?>

<?php
// 514A     Чубакка и число
$in = fopen("php://stdin", 'r');

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

//list($x1, $y1, $x2, $y2) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

$str = substr($input_line, 0, strlen($input_line)-2);
$len = strlen($str);

for ($i=0; $i < $len; $i++) {
    if ($str[$i] > '4') {
        $str[$i] = (string) (9 - (int) $str[$i]);
    }
}

for ($i=0; $i < $len; $i++) {
    if ($str[$i] !== '0') {
        break;
    } else {
        $str[$i] = '9';
    }
}

echo $str;

?>

<?php
// 514A     Чубакка и число
$in = fopen("php://stdin", 'r');

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

//list($x1, $y1, $x2, $y2) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

$str = substr($input_line, 0, strlen($input_line)-2);
$len = strlen($input_line);

for ($i=0; $i < $len; $i++) {
    if ($str[$i] > '4') {
        $str[$i] = (string) (9 - (int) $str[$i]);
    }
}

for ($i=0; $i < $len; $i++) {
    if ($str[$i] !== '0') break;
}

if ($i == $len) {
    echo "0";
} else {
    echo substr($str, $i);
}

?>

<?php
// 514A     Чубакка и число
$in = fopen("php://stdin", 'r');

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

//list($x1, $y1, $x2, $y2) = preg_split('/ /', substr($input_line, 0, strlen($input_line)-2), -1, PREG_SPLIT_NO_EMPTY);

$str = substr($input_line, 0, strlen($input_line)-2);
$len = strlen($input_line);

for ($i=0; $i < $len; $i++) {
    if ($str[$i] > '4') {
        $str[$i] = (string) (9 - (int) $str[$i]);
    }
}

for ($i=0; $i < $len; $i++) {
    if ($str[$i] !== '0') break;
}

if ($i == $len) {
    echo "0";
} else {
    echo substr($str, $i - 1);
}

?>


<?php
    $input = readline();
    $input = str_replace(' ', '', $input);
    $input = strtolower($input);
    $inputArray = str_split($input);
    $sizeArray = count($inputArray);
    $array = array("a", "e", "i", "o", "u", "y");
    $ban = false;
    foreach ($array as $key=>$valor) {
        if ($valor == $inputArray[$sizeArray-2]) {
            $ban = true;
            break;
        }
    }
    if ($ban) {
        echo "YES";
    }else{
        echo "NO";
    }
?>

<?
$g=array('A', 'E', 'I', 'O', 'U', 'Y');
$str=trim(fgets(STDIN));
$str=strtoupper(preg_replace('/(\s+)|\?/','',$str));
$len=strlen($str)-1;
for($i=0,$n=sizeof($g);$i<$n;$i++){
    if($g[$i]==$str[$len]) {
        $res="YES";
        break;
    }
}
if($res=="") $res="NO";
echo $res;
?>

<?
$fp=fopen('php://stdin', 'r');
$lines=stream_get_contents($fp);

$lines=trim($lines);

$lines=rtrim($lines, "?");
$lines=trim($lines);
$n=strlen($lines)-1;

if (in_array(strtolower($lines{$n}), array("a", "e", "i", "o", "u", "y")))
    echo 'YES';
else
    echo 'NO';
?>

<?php
    $input = fgets(STDIN);
    $input = str_replace(' ', '', $input);
    $input = strtolower($input);
    $inputArray = str_split($input);
    $sizeArray = count($inputArray);
    $array = array("a", "e", "i", "o", "u", "y");
    $ban = false;
    foreach ($array as $key=>$valor) {
        if ($valor == $inputArray[$sizeArray-2]) {
            $ban = true;
            break;
        }
    }
    if ($ban) {
        echo "YES";
    }else{
        echo "NO";
    }
?>

<?php
    $input = trim(fgets(STDIN));
    $input = strtolower($input);
    $inputArray = str_split($input);
    $sizeArray = count($inputArray);
    $array = array("a", "e", "i", "o", "u", "y");
    $ban = false;
    foreach ($array as $key=>$valor) {
        if ($valor == $inputArray[$sizeArray-2]) {
            $ban = true;
            break;
        }
    }
    if ($ban) {
        echo "YES";
    }else{
        echo "NO";
    }
?>

<?php
    $input = str_replace(' ', '', fgets(STDIN));
    $input = strtolower($input);
    $inputArray = str_split($input);
    $sizeArray = count($inputArray);
    $array = array("a", "e", "i", "o", "u", "y");
    $ban = false;
    foreach ($array as $key=>$valor) {
        if ($valor == $inputArray[$sizeArray-2]) {
            $ban = true;
            break;
        }
    }
    if ($ban) {
        echo "YES";
    }else{
        echo "NO";
    }
?>


<?php
$IN = STDIN;
fscanf($IN, "%d", $n);
$needval = $n-10;

if ($needval==10)
  echo 15;
elseif ((0<$needval)&&($needval<12))
  echo 4;
else
  echo 0;

?>

<?php
$IN = STDIN;
fscanf($IN, "%d", $n);
$needval = $n-10;

if ($needval==10)
  echo 15;
elseif ((0<$needval)&&($needval<22))
  echo 4;
else
  echo 0;

?>


<?php
$mod = 1000000007;
$intMaxValue = 2147483646; //2147483647

$loop = true;
$t = $loop ? IO::get() : 1;
while($t--) {
    solve();
}
//101
//101
//001
function solve()
{
     $x = IO::get();
    $a = IO::getArray();

 $ans = 'YES';

 if($a[$x-1] != 0) {
      $x = $a[$x-1];
      if($a[$x-1] != 0) {
           $x = $a[$x-1];
      } else {
           $ans = 'NO';
      }

 } else {
      $ans = 'NO';
 }

   IO::pr($ans);

}

class IO {
    public static function get()
    {
        return trim(fgets(STDIN));
    }

    public static function getArray()
    {
        return explode(' ', trim(fgets(STDIN)));
    }
    public static function pr($s)
    {
        echo $s, PHP_EOL;
    }
    public static function prArray($s)
    {
        echo implode( ' ', $s), PHP_EOL;
    }
    public static function getMinValue($x, $y) {
        return $x > $y ? $y : $x;
    }
    public static function getMaxValue($x, $y) {
        return $x > $y ? $x : $y;
    }
}

<?php

$testCases = fgets(STDIN);

$answers = [];
for ($i=0; $i < $testCases; $i++) {
    $key = (int) fgets(STDIN);
    $keysBehind = array_map('intval', explode(' ', fgets(STDIN)));

    if (
        $keysBehind[$key - 1] !== 0
        && isset($keysBehind[$keysBehind[$key - 1] - 1])
        && $keysBehind[$keysBehind[$key - 1] - 1] !== 0
    ) {
        $answers[] = 'YES';
    } else {
        $answers[] = 'NO';
    }
}

foreach ($answers as $item) {
    echo $item . PHP_EOL;
}

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

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

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

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

fscanf($input, '%d%d', $request, $modulus);
$result = [];
$number = 0;

while (count($result) < $request) {
    $number++;
    $palindrome = $number . strrev($number);
    $result[$palindrome] = true;
}

$sum = 0;

foreach (array_keys($result) as $item) {
    $sum = bcadd($sum, $item);
}

echo bcmod($sum, $modulus), PHP_EOL;

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));
$c = 0;
for($x = 1; $x <= $a; $x++)
{
     $d = $x . strrev($x);
     $c = bcadd($c, $d);
}
$e = bcmod($c, $b);
print $e;
?>