32 lines
609 B
Java
32 lines
609 B
Java
package chelper;
|
|
|
|
import static misc.Stuff.min;
|
|
|
|
import io.InputReader;
|
|
import io.OutputWriter;
|
|
import misc.SimpleSavingChelperSolution;
|
|
|
|
|
|
public class A extends SimpleSavingChelperSolution {
|
|
|
|
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
|
wrapSolve(testNumber, in, out);
|
|
}
|
|
|
|
@Override
|
|
public void solve(int testNumber) {
|
|
int n = in.nextInt() - 1;
|
|
int a = in.nextInt();
|
|
int b = in.nextInt();
|
|
int c = in.nextInt();
|
|
|
|
long ans = min(a * n, b * n);
|
|
|
|
if (n >= 1) {
|
|
ans = min(ans, a + c * (n - 1), b + c * (n - 1));
|
|
}
|
|
|
|
out.println(ans);
|
|
}
|
|
}
|