Problem:
Score : 200 points

Problem Statement

Snuke has N integers. Among them, the smallest is A, and the largest is B.
We are interested in the sum of those N integers. How many different possible sums there are?

Constraints

1 ≤ N,A,B ≤ 10^9

A and B are integers.

Input

Input is given from Standard Input in the following format:

N A B

Output

Print the number of the different possible sums.

Sample Input 1

4 4 6

Sample Output 1

5

There are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.

Sample Input 2

5 4 3

Sample Output 2

0

Sample Input 3

1 7 10

Sample Output 3

0

Sample Input 4

1 3 3

Sample Output 4

1

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int min = 0;
		int max = 0;
		int cnt = 0;

		if(n == 1) {
			if(a == b) {
				cnt++;
			}else if(a != b) {
				//なにもしない
			}
		}else if(n > 1) {
			if(a > b) {
				//なにもしない
			}else if(a < b){
				for(int i = 0 ; i < n ; i++) {
					min += a;
					max += b;
				}
				cnt = (max - b + a) - (min - a + b) + 1;
			}else if(a == b){
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}