Language: Java

<?php

class In {

	private $buf = [];
	private $count = 0;
	private $pointer = 0;

	public function nextLine() {
		$ret = '';
		if($this->hasNext()){
			while($this->hasNext()){
				$ret .= $this->next();
			}
		}else{
			$ret = trim(fgets(STDIN));
		}

		return $ret;
	}

	public function next() {
		if(!$this->hasNext()) {
			$str = trim(fgets(STDIN));
			$this->buf = explode(' ',$str);
			$this->count = count($this->buf);
			$this->pointer = 0;
		}

		return $this->buf[$this->pointer++];
	}

	public function hasNext() {
		return $this->pointer < $this->count;
	}

	public function nextInt() {
		return (int)$this->next();
	}

	public function nextDouble() {
		return (double)$this->next();
	}
}

class Out {
	public function println($str = '') {
		echo $str . PHP_EOL;
	}
}

$in = new In();
$out = new Out();

$N = $in->nextInt();
$A = $in->nextInt();
$B = $in->nextInt();

if ($A > $B) {
	$out->println(0);
	return;
}

if ($N <= 1) {
	if ($A == $B) {
		$out->println(1);
	} else {
		$out->println(0);
	}
	return;
}

$ans = ($N - 2) * ($B - $A) + 1;

$out->println($ans);

?>


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
<?php
^
Main.java:5: error: <identifier> expected
	private $buf = [];
	            ^
Main.java:5: error: illegal start of expression
	private $buf = [];
	               ^
Main.java:6: error: <identifier> expected
	private $count = 0;
	              ^
Main.java:7: error: <identifier> expected
	private $pointer = 0;
	                ^
Main.java:10: error: empty character literal
		$ret = '';
		       ^
Main.java:13: error: <identifier> expected
				$ret .= $this->next();
				      ^
Main.java:25: error: not a statement
			$this->buf = explode(' ',$str);
			^
Main.java:26: error: not a statement
			$this->count = count($this->buf);
			^
Main.java:27: error: not a statement
			$this->pointer = 0;
			^
Main.java:47: error: <identifier> expected
	public function println($str = '') {
	                            ^
Main.java:47: error: empty character literal
	public function println($str = '') {
	                               ^
Main.java:48: error: ';' expected
		echo $str . PHP_EOL;
		         ^
Main.java:48: error: not a statement
		echo $str . PHP_EOL;
		            ^
Main.java:52: error: class, interface, enum, or record expected
$in = new In();
^
Main.java:53: error: class, interface, enum, or record expected
$out = new Out();
^
Main.java:55: error: class, interface, enum, or record expected
$N = $in->nextInt();
^
Main.java:56: error: class, interface, enum, or record expected
$A = $in->nextInt();
^
Main.java:57: error: class, interface, enum, or record expected
$B = $in->nextInt();
^
Main.java:59: error: class, interface, enum, or record expected
if ($A > $B) {
^
Main.java:61: error: class, interface, enum, or record expected
	return;
	^
Main.java:62: error: class, interface, enum, or record expected
}
^
Main.java:67: error: class, interface, enum, or record expected
	} else {
	^
Main.java:69: error: class, interface, enum, or record expected
	}
	^
Main.java:71: error: class, interface, enum, or record expected
}
^
Main.java:75: error: class, interface, enum, or record expected
$out->println($ans);
^
Main.java:77: error: class, interface, enum, or record expected
?>
^
27 errors