import java.util.Scanner;
public class ass {
    
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int f=in.nextInt();
        int s=in.nextInt();
        int r=in.nextInt();
        int v=in.nextInt();
        int t=s+f;
       if(f+s-(s+f)/r>=f&&f+s-(s+f)/v>=s)
           System.out.print(s+f);
       else{if(f+s-(s+f)/r<f)
           t++;
           if(f+s-(s+f)/v<s)
               t++;
           System.out.print(t);
       }}}