#include using namespace std; long long inf = 1001001001001001001; int main() { long long N; int A,B; cin >> N >> A >> B; long long ans = inf; ans = min(ans,(A-B)*(N-2)+B-B-A); ans = min(ans,(B-A)*((N-1)/2)+B-(B+A)*(N/2)); ans = min(ans,(B-A)*(N/2)-B-(B+A)*((N-1)/2)); ans = min(ans,(A-B)*(N-1)-B); ans = min(ans,(A-B)*(N-2)-B+B-A); cout << ans << endl; }