
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Sagimbekov_MA
 */
public class B483 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long c1 = sc.nextLong();
        long c2 = sc.nextLong();
        long x = sc.nextLong();
        long y = sc.nextLong();
        System.out.println((c1 + c2)*x*y/(x*y - 1) + (((c1 + c2)*x*y) % (x*y - 1) != 0 ? 1 : 0));
    }
    
    
}
