https://www.acmicpc.net/problem/14470
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int a=s.nextInt(),b=s.nextInt(),c=s.nextInt(),d=s.nextInt(),e=s.nextInt();
int time=0;
if(a<0){
time+=Math.abs(a)*c;
a=0;
}
if(a==0) time+=d;
time+=(b-a)*e;
System.out.print(time);
}
}