unittest
{
	assert( [ "4 4 6" ].parse.expand.solve == 5 );
	assert( [ "5 4 3" ].parse.expand.solve == 0 );
	assert( [ "1 7 10" ].parse.expand.solve == 0 );
	assert( [ "1 3 3" ].parse.expand.solve == 1 );
}

import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nab = input.front.split.to!( long[] );
	return tuple( nab[ 0 ], nab[ 1 ], nab[ 2 ] );
}

auto solve( long n, long a, long b )
{
	if( b < a ) return 0L;
	if( n == 1 && b != a ) return 0L;
	return 1 + ( b * ( n - 2 ) ) - ( a * ( n - 2 ) );
}
